Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse giving error, missing R.java file after recent update

I have updated my SDK and ADT to the latest version, I have also update the Eclipse to Kepler the latest one after Juno.

My ADT version is 22.0. After this update when I create a new project, I'm getting error, stating R cannot be resolved to a variable. I have imported import android.R;, but it is showing as unused import stating Don't include android.R here; use a fully qualified name for each usage instead.

Same thing is happening with Mac OS also with the latest update. I have tried renaming activity_main.xml to other name, but still my R.java is not generated.

Tried all the things which are possible. Cleaned the project, build the whole workspace. Nothing helping.

I think ADT or Eclipse compatibility is having problem after the update.

I have updated my whole SDK, here is the screenshot, but same problem is there.

enter image description here

like image 477
Anupam Avatar asked May 17 '13 12:05

Anupam


4 Answers

After updating to SDK Tools to rev. 22 for the first time, you may need to relaunch Android SDK Manager again and install a new item: Android SDK Build-tools. enter image description here

After installing this, clean your projects and rebuild.

like image 127
Krauxe Avatar answered Nov 15 '22 04:11

Krauxe


import android.R - remove this statement from all your classes and then do a clean your R file will be generated. if this did not work then check all your xml files for any errors and then do a clean. These 2 are the most common reasons for R file to go missing

like image 2
prvn Avatar answered Nov 15 '22 06:11

prvn


Yesterday, I made an update with sdk manager, and I had the same problem as you. I fixed the issue: I have updated another time the android sdk (with the sdk manager tool), then I check update from eclipse for install the updated ADT plugin and I rebuid my project. "Android sdk Build-tools" from Android sdk manager is now rev 17 and now it is OK. I think the issue is from adt plugin from eclipse

like image 6
Jarvis Avatar answered Nov 15 '22 06:11

Jarvis


Changes in your Build target also can effect R.java in Eclipse so

Right Click Project >> Properties >> Android >> Select Latest(usually) Android API Platform >> Click OK

Hope this is helpful.

like image 1
Sudhindra_Chausalkar Avatar answered Nov 15 '22 06:11

Sudhindra_Chausalkar