• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Help! Eclipse can't resolve R.drawable?!?

l0ki

Lurker
Oct 24, 2010
5
1
Let me explain, my laptop crashed and my game was working lovely, but since my laptop has rebooted I keep getting this:

R cannot be resolved to a variable

And now I can't even build the program. All the assets are still there and referenced correctly, but eclipse is having a fit...

Also, importing android.R - does nothing, which is what I thought, and you shouldn't need to import it anyway!?

Any help is greatly appreciated.
 
Hi,

Check that the project is an Android project first. Right-click the project, go to Android Tools (At the bottom), then it's something like "Convert To Android Project", if you don't see that, then it is already an Android Project. Assuming that the SDK is setup on your computer, right click the Project, go to Properties.

Do you see an "Android" option? If so, check the version of Android you are targeting.

Then go to "Java Build Path", press "Add External Jars", then and search for the Android jar that targets your runtime. In my case, I target 2.2 and I found the JAR at "C:\Program Files\eclipse\android-sdk-windows\platforms\android-8\android.jar", your file is probably different.

You'll need to press "Ctrl-B" if you're using Windows to initiate a Build All in Eclipse.

Let me know if you have any other questions.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones