After upgrading the SDK, my project appeared with errors

Asked

Viewed 975 times

1

After I updated the SDK and downloaded the new version of Eclipse, gave errors in src and gen of my project, I have no idea what it might be.

inserir a descrição da imagem aqui

If anyone can help me I’d really appreciate it.

  • 2

    Your question is too wide. Could you at least post the mistakes?

  • Sorry, I thought it would be unnecessary to post the errors since it might be some problem other than in the code. But here is a printout of the errors : http://suman.com.br/erros.png

  • 1

    Try to clean the project. Project=>clean...

  • Try going back to the version and see if the errors got out, if they don’t get out it’s some error in the classes of your project...Sometimes the Android SDK can’t compile something by some error on Androidmanifest...

1 answer

1

I believe it’s a class R error.

R.java is a file that Eclipse Android plugins creates while building your application. R.java is created under the directory "gen". This file is generated from the information in the directory "res". If you run select "Project" -> "Clean ..." in the Eclipse menu, it will remove and then generate the file R.java.

The problem "R cannot be solved" happens when you change your package name in the file AndroidManifest.xml. It uses its Android package name to create a subdirectory in the directory "gen", where he keeps the file R.java.

Eclipse may also have clean run issues because it gets confused about where the file is R.java then you changed the name of the Android package. You can change the subdirectory name in gen to match your new package name, or you can change your package name back to the old one. Make the clean and then change the package name to the new name you want. This works best if you stop Eclipse from trying to build while you’re changing the package name.

Under the "Project" menu uncheck the "Build Automatically" option and also when "Clean ..." asks if it should "Start a build immediately" uncheck the box so that it do not try to build while you are changing the package name. Once you have changed the name you can leave "Build Automatically" again.

Note that if your Androidmanifest.xml filename does not match your Java package name, Eclipse will automatically add a "importação <seu Android pacote name> R;." line in all your files java. which have any references to R. If you change the name of the Androidmanifest.xml package, sometimes Eclipse doesn’t update all these additional imports. If so, use the Refactoring of the Eclipse (ALT + Shift + R) to change the import declaration in one of your Java files to your new package name Androidmanifest.xml. Remember, it is best to do this while you have disabled "Build Automatically".

Browser other questions tagged

You are not signed in. Login or sign up in order to post.