Solve the Problem of java. lang. NoClassDefFoundError running Eclipse add external jars

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.