How Android correctly references other jar packages (RPM)

Source: Internet
Author: User

Ext.: http://blog.csdn.net/liranke/article/details/17226083

Android projects often need to refer to custom or external jar packages, which provide some experience for reference.

I. GENERAL Practice:

1. Normally, copy the jar package directly to the Libs directory in the Eclipse project, and Eclipse will automatically refer to it, where the Red fork in the code disappears.

2. Check whether private libaries and dependencies in the order and export in Build path are checked, and the correct option is to tick.

Then clean the whole project, and then run the can.

3. Your jar file must also be created by the Android project, otherwise, "Java.lang.NoClassDefFoundError" and other errors will occur, here is an error:

12-09 00:43:05.172:E/DALVIKVM (4456): Could not find class ' com.example.test4androidjar2.Jar4Android ', referenced from Method Com.example.filemanagertest4android.mainactivity$1.onclick

4. Your jar package must be edited and compiled under Android, packaged, and not packaged in Java. Filemnager is one example.


Two. Exceptions that may be caused:

1. Could not find class ...

2. Vfy:unable to resolve New-instance 643 .....

3. Could not find class ' com.example.test4androidjar2.Jar4Android '

4. Java.lang.NoClassDefFoundError ...


Three. Workaround:

Refer to the above mentioned in "I. General practice".

How Android correctly references other jar packages (RPM)

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.