Here are some common solutions, the specific contents are as follows:
1. Sometimes eclipse does not compile automatically, clean the project and regenerate R.java
2. Select the menu Project >> Clean, provided that Bulid Automatically is checked. After clicking Clean, the project will be rebuilt, because generally, the R.java file will be reupdated at this time. If there is any error in the project, it will not be automatically generated.
3. Select the project, right-click Android Tools >> Fix Project Properties This operation can sometimes correct some errors.
4. The match_parent property is not seen in the layout_height of the old version 1.5/1.6/2.1. The property of android:layout_height="match_parent" will cause the XML to be unable to compile and cannot generate R.java
This is a situation that may occur after downgrading the advanced version. The solution is to replace match_parent with fill_parent
When importing other source codes, first of all, you must ensure that the SDK version of the source code is consistent with your eclipse default version.
5. When there are other xml and class errors in the project, it will not be automatically compiled, and when there are errors in the jar package reference, it will not be automatically compiled.
Also attached:
To view the source code version: Open the default.properties file and see what the number after 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 Others are tested by yourself.
The above introduces the solution to writing java programs under Eclipse that will not automatically generate R.java files and packages. I hope that this article sharing can help you.