Eclipse: including jar file into dex build?

Put your problem here if it does not fit any of the other categories.

Eclipse: including jar file into dex build?

Postby tolonuga » Mon Oct 06, 2008 3:37 pm

Hi.

I created a libs/ dir, put a jar file in there, references it in the eclipse
library build path, so now my code builds using the code in there.

but installing the dex file into the emulator fails, as the code from
the jar file is missing. How to I tell (using eclipse) to include that
code into the dex?

I had a look at the commonsware android book, but it tells me for
ant putting jar files in libs/ directory is all I need to do, for IDE I
need to reference the jar file. I managed to do that in term of
build path only (so that my code referencing stuff in the jar file
builds fine). but not what I need to do, so the application dex package
includes the code from the jar too.

any idea what I need to do?

thanks, Andreas
tolonuga
Freshman
Freshman
 
Posts: 2
Joined: Mon Oct 06, 2008 3:32 pm

Top

mentioned in the faq, but doesn't work for me

Postby tolonuga » Mon Oct 06, 2008 5:02 pm

This problem is even mentioned in the android development faq:
http://code.google.com/android/kb/commo ... nallibrary
--cut--
Adding an External Library (.jar) using Eclipse

You can use a third party JAR in your application by adding it to your Eclipse project as follows:

1. In the Package Explorer panel, right-click on your project and select Properties.
2. Select Java Build Path, then the tab Libraries.
3. Press the Add External JARs... button and select the JAR file.

Alternatively, if you want to include third party JARs with your package, create a new directory for them within your project and select Add Library... instead.

It is not necessary to put external JARs in the assets folder.
--cut--

ok, first time I had the library added with project -> properties -> java build path -> libraries -> add jar, and that didn't as I wrote above. after finding this FAQ entry I went back, deleted the jar from the build path, instead added a library, selected user library, gave it some name, and then in the user library added the jar.

but: this didn't change anything. in my case the jar contains the com.google.zxing code and
still when eclipse uploads the dex to the emulator, I see the same error in logcat: installation
failed because com.google.zxing is missing (INSTALL_FAILED_MISSING_SHARED_LIBRARY).
any idea how I can fix this?

Thanks for your help. Regards, Andreas
tolonuga
Freshman
Freshman
 
Posts: 2
Joined: Mon Oct 06, 2008 3:32 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 23 guests