0

I have an Android Apps (A) project that depends on a Library project (B). The library project contains code as well as third-party jar files and some other jars that were exported from projects C and D. In Eclipse, I have project B specified as a library project.

However, when I connect my device and run project A (Run As -> Android Application), it crashes on the device and when I examine the LogCat output, there is a NoClassDefFoundError exception for one of the classes that exists in the jar files of project C.

When I unpack the B.jar file in Project B's bin folder, it does not contain anything else besides the META-INF/ folder with an empty MANIFEST.MF file. So this indicates that something seems to be going wrong someplace, but I'm unable to figure it out.

Could anybody help me with this issue?

1 Answer 1

1

Are you working with the latest ADT plugin and SDK revision? That is rev 22.x. If so there has been an important change to the dependency management.

Possible solution

For some reason the contents of the Order and Export tab has completely changed and you now have to export the Android Private Libraries from your library projects. See screenshot below:

enter image description here

More details

The tricky part of this change is that your project still compiles properly in Eclipse so you're not aware of any issues. Until you deploy the app on an emulator or device and you get the ClassDefNotFoundException on any call of a library project.

Not confirmed but I believe this is related to recent changes for maven support, also related to android studio preview

Similar change in the past

This reminds me of a similar change in the update to rev 17 where the lib folder suddenly changed to libs and all content from the original lib folder wasn't packaged so you wouldn't see any issues in eclipse. Only once installed on a device.

More information that 'issue' is available on this link. If you search on stackoverflow for "sdk 17" and "classdefnotfound' you'll also get enoug questions about that change.

4
  • Thanks! That helps... partially. I had Project A also dependent on Projects C and D within eclipse, and when I removed that dependency, I now get compilation errors within eclipse. I'll do some more research on the issue like you mentioned and see if it that helps. I did upgrade to ADT 22.X a couple of days ago and ran into this issue then.
    – pingping
    May 29, 2013 at 19:19
  • Ok. I did manage to resolve the issue by clicking on each external jar that my projects were dependent on in the "order and export" tab and adding some more explicitly.
    – pingping
    May 29, 2013 at 20:02
  • Glad you've got it sorted. I ran into this earlier myself after the update. And on the rev 17 update also. It's amazing what money can do, it allows you to deploy these kind of changes without even informing developers :p May 29, 2013 at 20:09
  • Similar to your experience, this wasn't an issue until the upgrade. And then the sky began to fall after that :) Glad that it's resolved now. Now I can move onto resolving my other problems.
    – pingping
    May 29, 2013 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.