Android – R cannot be resolved to a variable [duplicate]
I think I found another solution to this question. Go to Project > Properties > Java Build Path > tab [Order and Export] > Tick Android Version Checkbox Then if your workspace does not build automatically… Properties again > Build Project