I have successfully linked a native shared library for an Android app using ndk-build. To test a JNI call, I have a small app that simply calls one function from the library. I run/debug using Eclipse.
On one PC, under Windows and Cygwin, the library is loaded and the call succeeds. On another PC, under Ubuntu, the same app fails calling System.loadLibrary("...").
Given that it works on the first PC, the only differences between the two relate to the Eclipse workspace, search path settings in the OS, and the like.
Unfortunately, I don't have much experience with Unix in general, so it may be just a matter of setting a search path for the shared library somewhere.
My library is certainly there. It's in libs/armeabi, also in obj/local/armeabi (don't know why, and interestingly it has a larger size there), and it's in the APK file.
Can anyone give me a hint? That would be most welcome.
P.S. I should add that on the Windows PC (where it works), in an attempt to debug the native code, I have applied changes to the Eclipse project like converting it to a mixed Jave/C++ project and configuring it to build the native library from within Eclipse. I don't know whether those project settings could be hurting the Ubuntu environment; just wanted to add the information. In any case, I debug the app as an Android (not C++) app.
Started from scratch using the HelloJNI sample and it works. There must have been something fundamentally wrong with my Eclipse project setup. So, in a way, it's solved :-)
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog should be missing in your Android.mk file. I tried this in my Android.mk file and it worked fine for me.
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