Reputation: 87
I have a problem with Android Studio 0.4.2. The R.java is not updated when I create or update layout resources files. I have seen there was an issue on earlier versions of Android Studio that deals with that problem but it doesn't to work anymore for Android Studio 0.4.2. Android Studio doesn't seems to log any error message when I build the module. I have also seen similar questions but mainly for Eclipse and I didn't find answers for Android Studio 0.4.2. Furthermore, I imported this module into Android Studio From an ADT Eclipse project.
Upvotes: 2
Views: 8630
Reputation: 7144
Closing Android studio completely and re-opening it again seems to work for me sometimes.
Although this is not specific for 0.4.2, I have been using this technique since 0.6.* up to current version (0.8.* as of today)
Upvotes: 1
Reputation: 87
Concerning my project imported from Eclipse with ADT, I finally noticed that the R file in the gen directory (inherited from the Eclipse projet and configured as generation directory in the Android Facet of my Android Studio Projet), is just a stub and doesn't contains the code available at the compile time.
In fact, the generated elements are available in the code suggestions when coding and the Android Studio module compiles well. I concluded from it that it's the behavior of Android Studio when importing Eclipse ADT projects.
I hope am i not wrong.
Upvotes: 0
Reputation: 2492
If what @MDMalik said doesn't work, try removing the project from the workspace and importing it again.
Also, check to see if there are any problems in your layout xml files. An error in those sometimes stops R.java from being generated!
Upvotes: -1
Reputation: 4001
Yes you always have to Clean
your Project and Re-build
the Project
For the resources to appear in your code.
Don't ask why or who, they don't like it ;)
Upvotes: 1