Search code examples
javaandroidjarlibrariesnoclassdeffounderror

Android sub-library not in build path


I'm currently making an App which uses a library (Let's call it parentLib) that I have made. This library also uses another library I have made (Let's call it childLib). So the top app is including a .jar file (parentLib), and in that .jar file is another .jar file (childLib).

The problem though, is that when I come to use an aspect of the sub-library (childLib) from the top level app, I get a NoClassDefFoundError message, which crashes the app.

The weird thing is, if I add the sub-library (childLib) into the App's libs folder alongside the library (parentLib) directly, then things work, even though it's not actually using those library files. It seems as if it just needs the sub-library (childLib) adding to the build path of the library (parentLib) so that the app knows where to look for it, but I'm really not sure?

The sub-library (childLib) works perfectly when used directly form the initial App, but I need to be able to distribute the sub-library (childLib) as part of a single file (parentLib.jar) which includes it.

Any help is much appreciated, thanks in advance!


Solution

  • Resolved by moving to Android Studio.