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
I had this same issue. The package name was wrong in two of the following three files. I manually updated the package name and everything started working again.
gen/com/example/app/BuildConfig.java
gen/com/example/app/Manifest.java
gen/com/example/app/R.java
I'm not sure what caused them to change as I've never modified these files before.
This is probably due to a failed resource build
Once the issue is fixed, a mere Build > Rebuild Project
will do the trick
just clean project and then sync your project with gradle file.
This issue starting occurring for me when I started working with build.gradle to incorporate the data necessary (signingConfigs) to build a signed .apk. After what appeared to be a successful build from the command line, I discovered that going into any class using R.* that all R.* references were unresolved.
The answers here didn't help me. I decided to re-import the project and it magically fixed the issue. File/Import Project... and select the build.gradle file in my apps root folder. I would love to know why re-import fixed this :)
Regarding the following, from Crossle Song's answer
- Press F4 into Project Structure, Check SDKs on left
- Click Modules ---> Source Tab, check gen and src as sources
Despite the message "We will provide a UI to configure project settings later....etc" this worked for me.
For me, with Android Studio 1.5.1, the solution was to recreate the whole project with a slightly different name.
I think it didn't handle the app name "Kommentator_AS", because several places the package was named"Kommentator" instead.