Skip to content Skip to sidebar Skip to footer

Importing Class From External Jar, Android

I created a new library and added the jars from web harvester to do a bit of web scraping in my android project. in my main activity I import classes that I need. but starting the

Solution 1:

I had a problem where a jar was not exported to the apk. I manually edited .classpath and added exported="true" to the classpathentry; seems to have fixed my similar problem.

<classpathentry kind="lib" exported="true"path="lib/gson-1.7.1.jar"/>

Solution 2:

Take a look here http://developer.android.com/guide/appendix/faq/commontasks.html#addexternallibrary are you placing the jar in subfolder of your project ?

Solution 3:

Well, first thing is to check that the library has the right java version. android only support 1.6 and not 1.7 (SDK dependent, but if you want it to work under 2.33, use 1.6) . after that, just drag the file to the libs folder, and select copy. Then, click project properties (right click on the project->properties)-> java build path->libraries tab. in this tab click add JARs and not add external JARs. Select the jar file from your project under the libs folder. If you are still getting the error, make sure your jar file java version is 1.6.

Post a Comment for "Importing Class From External Jar, Android"