Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fresh install of Eclipse, R cannot be resolved to a variable [duplicate]

I have come across the "R cannot be resolved" error countless times but there has always been an easy fix. Sorry to trouble you but I'm stumped this time...

I recently decided to dual boot my computer into Windows 7/Ubuntu (previously Windows 7 only) and load Eclipse for my Android app development, however I came across the infamous R cannot be resolved error.

After a clean install of Ubuntu 12.10, I set up Google's ADT Bundle from the Android Developer website. I installed the Eclipse, SDK and ADB that were included in the package from the above download (ADT came pre-installed/setup). This is a special version of Eclipse provided by Google and includes the text "Android Developer Tools" when Eclipse is started.

Eclipse runs Java Projects fine, the SDK Manager seems to be set up correctly because I can launch it directly from Eclipse (I have also installed all of Android SDKs 1.5-4.2), AVD Manager almost works correctly (it launches and allows me to create new devices but will not start with the message "PANIC: could not open: some_device"), however any Android project will not compile with the error "R cannot be resolved to a variable".

I have tried using my existing Android projects from two of my old workspaces as well as creating a new workspace but they all resort to the same error.

Any advice? I would really like to begin working in a Linux-based environment and have spent several hours trying to get this to work...

I would highly appreciate anyone's ideas/advice/solutions/pity/etc.

EDIT: I'm starting to think this problem is probably connected to my other error when launching an Android Virtual Device where it states "PANIC: could not open: some_device". Sadly I have no idea what's causing this nor how to fix it either...

like image 469
feztheforeigner Avatar asked Dec 22 '12 10:12

feztheforeigner


2 Answers

I had the same issue. Fresh install of ADT Bundle, creating a new project using wizard, was giving me "R cannot be resolved to a variable" error. I tried everything explained in previous post.

In my particular case, it was that I had another copy of Android SDK tools and ADT Bundle was pointing to that one, instead of the one that comes with the bundle. I just changed that, and all projects were working again. Hope this helps.

like image 178
fr4gus Avatar answered Oct 24 '22 05:10

fr4gus


sudo apt-get install ia32-libs
like image 23
Seven Yu Avatar answered Oct 24 '22 04:10

Seven Yu