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.
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.
After installing this, clean your projects and rebuild.
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
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With