I have created simple app to test the scenario which is failing with NoClassDefFoundError
.
Lets take for example i have Test1 android project with Class TestClass with some methods.
This Test1 project i exported as a test1.jar and exported only source folder with Class TestClass and classpath
and .project
files.
In another android project Test2 i added this test1.jar
in my libs folder. And in this Test2 project i have a class Test2Class which calls methods of test1.jar class.
After this i exported this Test2 project as test2.jar
file following above steps.
So when i use this test2.jar
in another project i get this above error NoClassDefFoundError
. It is the scenario of jar inside a jar.
Is anywhere should i do something so i am able to access a jar inside a jar.
Thanks in advance.
Try this Step by step:
1. Remove all library
projects then Clean.
2. Go to first Project Test1
Right click Properties -> Android. Check Is Library
(make it library).
3. Go to second Project Test2
Right click Properties -> Android in the Library section select Add
-> Add first project as library.
4. Go to second Project Test2
Right click Properties -> Android. Also, Check Is Library
.
5. Go to third project C
Right click Properties -> Android. In the Library section select Add
-> Add First and Second as library. (Do not make Proj C as library)
6. Now Clean everything and run Proj C
.
Edit:
You can also see this bug Bug 405212 - Do not pack jars bundled inside a packed jar and Bug 361628 - Nested jars cannot be unpacked with Java 1.7. Try the above way it should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With