I have an Android application (running on Android Studio). It is made of 2 modules: - There is a low level pure java module (let’s call it module A). - On top of it, there is the module B which is the Android application. It relies on moduleA for some processings.
This is working fine.
I now need the module A to call an external Library. I have downloaded the JAR file and put it in moduleA/libs folder. This libs folder is referenced in gradle dependency of moduleA so the compilation is OK. However, there is an exception at runtime:
FATAL EXCEPTION Caused by: java.lang.ClassNotFoundException: Didn't find class "XXXX" on path: DexPathList
I have seen that the APK doesn’t contain the JAR file so it is normal that this exception occurs.
If I copy the same JAR file in moduleB/libs, then it works fine but I have the JAR file two times in the project! What is the clean solution to handle this? I guess that it can be solved with gradle but I don't know how.
Thank you very much Olivier