I have a C++ library and I made some JNI code to export it into the Android world. I also created an Android App which uses my JNI interface.
To use the library, I imported all the *.java and *.h / *.cpp files in my Eclipse App project (into the right folder), then I created the *.mk files for the NDK. I compiled the library with ndk-build and loaded it into the target device with Eclipse. The App works fine.
Now I would like to separate the App from the library. So, I compiled name.jar which contains the Java files of the JNI interface, then I compiled the libname.so with ndk-build for the C++ stuff. Then I put name.jar into newproject/libs and libname.so into newproject/libs/armeabi. Consider “newproject” the App I created without the library source code (I don’t want to release the source code, only the .jar and .so).
The result is a crash of the App with the memory dump into LogCat. I used System.loadLibrary(“name”) in a static context.
Anybody can help me?
My procedure was OK. I found the problem: my app was loading the lib and it was running the C++ code. By the way the crash happened early on a socket() call. I had to set the INTERNET permission into the manifest file.