I am using a thirdparty jar file in my android project. When I add the jar to the build paths, via eclipse project -> properties -> java build path -> Libraries -> add external jar.
The project compiles fine until that line of code runs which uses any class from that jar and I get class not found exception at runtime and the program crashes.
I solved it by copying the third party jar file to the libs folder of my project. The class not found exception goes away.
Question:
Can someone please shed some light why this is required and why does it not just work with a reference from the project properties despite the fact it compiles fine.. Why do I have to explicitly copy it to libs folder ?
That is not the proper procedure for use with the Android build tools.
Correct.
Because only the JARs in
libs/are added to the APK file. The Java build path is pure a compile-time thing, not tied into Android’s packaging of APK files.