After I updated the SDK and downloaded the new version of Eclipse, it gave errors in the src and gen of my project, I have no idea what it might be.
If someone can help me, I would appreciate it.
After I updated the SDK and downloaded the new version of Eclipse, it gave errors in the src and gen of my project, I have no idea what it might be.
If someone can help me, I would appreciate it.
I think it's an R class error.
R.java
is a file that the Android Eclipse plugins creates when building your application. R.java
is created under the "gen"
directory. This file is generated from the information in the "res"
directory. If you run select "Project" -> "Clean ..."
from the Eclipse menu, it will remove and then generate the R.java
file.
The problem "R cannot be solved"
happens when you change your package name in the AndroidManifest.xml
file. It uses your Android package name to create a subdirectory in the "gen"
directory, where it stores the R.java
file.
Eclipse can also have clean execution issues because it gets confused about where the R.java
file is after you've renamed the Android package.
You can rename the subdirectory in the gen to match your new package name, or you can change your package name back to the old name. Make it clean and then rename the package to the new name you want. This works best if you stop Eclipse from attempting to build while you are changing the package name.
Under the "Project" menu uncheck "Build Automatically" and also when "Clean ..." asks if it should "Start a build immediately" uncheck the box so it does not try to build while you is changing the package name . Once you have changed the name you can leave "Build Automatically" again.
Note that if your AndroidManifest.xml file package name does not match your Java package name, Eclipse will end up automatically adding a "importação <seu Android pacote name> R;."
line to all your java.
files that have any references to R.
If you rename the AndroidManifest.xml package, Eclipse sometimes does not update all of these additional imports. If this happens, use Eclipse (ALT + Shift + R)
to change the import declaration in one of your Java files to your new AndroidManifest.xml package name. Remember, it is best to do this as long as you have disabled "Build Automatically".