Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"R cannot be resolved to a variable" after transferring Eclipse workspace from pc to mac

I'm switching my dev computer from windows 7 to a mac. I saved my old workspace and transferred the whole file to mac. Eclipse has found the workspace, but I'm getting the "R cannot be resolved.." error. I've tried the usual suggestions: Clean, build automatically, ctrl+shift+O, etc but it's not working. Is this right way to transfer workspaces? Thanks

like image 635
Broo Avatar asked Aug 25 '11 12:08

Broo


2 Answers

If you have copied the workspace folder, have you checked that the project is still pointing to the android SDK? I would imagine it is in a different location on the mac than the win 7 pc.

Also, if you've done ctrl+shift+o in eclipse then it may have tried to add an import for R which will stop it from using the autogenerated R file when building.

I've had the same problem quite a few times due to using 3 computers for android dev. Often have to open and close projects, and clean builds to get it working.

like image 126
Adam Avatar answered Nov 15 '22 04:11

Adam


A much more extensive discussion of this error message and solutions, from '09: R cannot be resolved - Android error

My problem was fixed by finding an XML error in Manifest.xml regarding the package name, as hinted at by Android - R cannot be resolved to a variable

like image 21
Walter K Avatar answered Nov 15 '22 04:11

Walter K