Solution for writing Java programs under Eclipse that suddenly don't automatically generate r.java files and packages

  • 2020-04-01 04:36:33
  • OfStack

Here are a few common solutions, as follows:

1. Sometimes eclipse doesn't compile automatically, so clean up the project and let r.ava regenerate

2. Select menu Project > > Clean, provided you check Bulid Automatically(automatic build deployment), and clicking Clean will rebuild the project, because normally the r.ava file will be updated to the build side at this point, and will not be Automatically generated if there is an error in the project.

3. Select project, right-click Android Tools > > The action Fix Project Properties can sometimes Fix some errors.

4. The attribute match_parent was not found in the SDK layout_height of the previous version 1.5/1.6/2.1. The attribute "match_parent" of android:layout_height="match_parent" will result in the failure of XML compilation to generate r.java

This is what might happen if the advanced version is downgraded, and the solution is to replace match_parent with fill_parent

When importing other source code, make sure that the SDK version of the source code is the same as your default version of eclipse.

5. The project will not be automatically compiled when there are other XML and class errors in the project, and will not be automatically compiled when there are jar references with errors.

Attach:

To view the source version, open the default.properties file and see what the number after the target=android-7 is.

Version correspondence: target=android-3 < - > Android 1.5, target = android - 4 < - > Android 1.6,

Target = android - 7 < - > Android 2.1, target = android - 8 < - > Android 2.2, target = android - 10 < - > Android 2.3.3,

Target = android - 14 < - > Android 4.0, target = android - 15 < - > Android 4.0.3, target = android - 16 < - > Android 4.1, target = android - 17 < - > Android 4.2 test others on your own.

The above gives you a solution for writing Java programs under Eclipse that suddenly does not automatically generate r.java files and packages. I hope this article can help you.


Related articles: