R.java file is not updated in Android Studio

By : Mirouf
Source: Stackoverflow.com
Question!

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.

By : Mirouf


Answers

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 ;)

By : MDMalik


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!

By : Smittey


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.

By : Mirouf


This video can help you solving your question :)
By: admin