Include jar into apk with eclipse

12,556

Solution 1

Make sure your .JAR is created with JavaSE-1.6, not 1.7

Solution 2

Not sure if you've resolved this, but I was having a similar problem and just adding the ".jar" file to the lib was not helping when I tried to run the app on the emulator.

What did finally allow me to make progress was to go through the same thing and add the library as described above, and then in the "Java Build Path" dialog, go to the "Order and Export" tab, and select the jar file there, too. Then the .apk was noticeably bigger, and the app got through the initial startup. (It still died afterward, but I think there is another permission problem there.)

I hope this helps?

Solution 3

Maybe you have tried this?:

Right click Project --> Properties --

  • Select Java Build Path
  • Make sure Libraries is the tab selected at the top
  • Click Add External JARs

Then find your JAR...you don't need it in your project.

Solution 4

For me, the following worked:

  1. Open .classpath file in project folder.
  2. Check it contains the row

    <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
    

    In my case, it was missing, so added it to the file.

  3. Restart Eclipse
Share:
12,556
Henrik
Author by

Henrik

Updated on June 04, 2022

Comments

  • Henrik
    Henrik almost 2 years

    I am trying to include a jar file in my apk file.

    I tried the following:

      • copy the jar into lib directory in my project
      • add jar to path
      • enable the jar for export
      • simply add the jar to my project path (location anywhere else)
      • enable jar for export

    But the apk does not include the jar. When I try to lanch the application the console tells me:

    Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
    Please check logcat output for more details.
    Launch canceled!
    

    I'm using

    Eclipse IDE for Java Developers Version: Indigo Service Release 1 Build id: 20110916-0149
    and
    Android Development Toolkit Version: 16.0.1.v201112150204-238534

    EDIT: This problem is solved. If I don't declare the libary as needed in the manifest it works. (Strange behaviour)