Reputation: 2024
For an added feature in my Android application, I downloaded an open-source code for some third party library. This was to make customization.
I am using Eclipse Juno.
I created a project out of the source code, made customization, built a JAR. And, I am using the JAR library in my project. The code in my application invokes the appropriate functions of the library on a particular screen.
The application compiles fine :)
However, when I run my application and navigate to the screen where I am making use of the library classes, I encounter the ClassNotFoundException
for the library class.
I diagnosed it further and observed that all the java class files are converted to DEX by the Dalvik VM.
All the third party libraries are placed into dexedLib directory under the bin, where the usual third party JAR includes META-INF directory and classes.dex file. But, the JAR I added, only included META-INF directory and NOT classes.dex. And hence the Exception.
I didn't observe any logs where Dalvik VM reports a conversion failure event.
I cleaned the project several times, loaded/reloaded projects into Eclipse, but no luck.
Also referred to the below post which talks about the very same problem, but for him clearing the project from Eclipse and reloading it again worked. android dexed lib is empty
Any help would be appreciated.
Upvotes: 4
Views: 480
Reputation: 1
I just run into same problem with including XZing to my application. For version 3.2.1 eclipse did not generated classes.dex but for older 2.3.0 did. I believe it is because newer version uses java 1.8 syntax, which is unsupported by older android SDK.
Upvotes: 0
Reputation: 628
since you are using Eclipse probably the issue is related to the way that the build is created:
go to : project properties | Java Build Path | Order and Export
check again that your jar is in the list (probably is already there). if yes select the checkbox next to it so the jar will be exported when the apk is created.
Enjoy... PS. I suggest you to move to Android Studio or to IntelliJ (Android studio father). ADT for Eclipse is deprecated and is not maintained anymore ..
Upvotes: 1