I\'m trying the new Android Studio. I\'ve exported a project from eclipse, using the build gradle option. I\'ve then imported it in Android Studio. The R.java file under gen
At first check if there is import android.R; in top of your class this happens when auto import in enable in android studio.
after that comment all lines of your code that you use R variable (you can comment entire class or ...) then run application it regenerates R variable and you can uncomment your code.
None of the answers on the web so far have helped. Build > Make Project did not work for me. For me it was as simple as choosing this other option (on Android Studio 1.3.1):
Build > Make Module 'module name'
My problem was that I had file 'default.jpg' in drawable folder and for some reason every resource was not resolved. Fixed after deleting that file!
I was also facing the same issue and I went through lot of answer on stackoverflow. Then i found one solution which help me resolve this issue.
Check package name in AndroidManifest.xml file. I forgot to change it while copy pasting another project into new project.
On IntelliJ 14
Check if the generated sources are excluded. Usually in Project Structure -> [module] -> Paths -> Compiler output: "Inherit compile output path"
I had the same problem and got it fixed by deleting an extra library.
To do try this solution go to File > Project Structure (on a mac you can use the command "Apple ;")
Then select app on the left tab. Go to the dependencies tab and delete the extra library.