Recently, I found a problem. Sometimes I repeatedly Add jar and remove jar for an Android project and find that the compilation is successful. However, when the application is applied to an external jar object, java is thrown. lang. noClassDefFoundError exception. This causes program to crash.
Check the project properties and find that Android Dependencies is missing in the java build path than in normal projects:
By comparing with the loss of the previous project, we found that the difference lies in the project root directory. classpath file, <classpathentry exported = "true" kind = "con" path = "com. android. ide. eclipse. adt. LIBRARIES "/> the exported here is changed to false, so here is changed back to true, and then the project is closed and opened again, and it is OK.
In addition, if the jar package you imported is not in the \ libs directory of the project directory, this problem also occurs. Put the jar package in the \ libs directory. Otherwise, the jar package can be compiled successfully, however, the preceding exception is caused because the jar is not packaged. Eclipse automatically packs the files in the \ libs directory during compilation.
This problem has never occurred before. I don't know if it is related to the Eclipse version and the ADT version.