Question

I created another question because all of the others were answered with a solution that was similar but unrelated. I have also ensured that it's not a symbol stripping issue.

I'm getting the dreaded error:

D/AndroidRuntime(16487): Shutting down VM
W/dalvikvm(16487): threadid=1: thread exiting with uncaught exception (group=0x41b1b700)
E/AndroidRuntime(16487): FATAL EXCEPTION: main
E/AndroidRuntime(16487): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.test/android.app.NativeActivity}: java.lang.IllegalArgumentException: Unable to load native library: /data/app-lib/com.test.test-1/libtest.so
E/AndroidRuntime(16487):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
E/AndroidRuntime(16487):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
...

Everything compiles and links just fine.

I also have app_dummy() and it's producing it properly as when I run with objdump I get it:

001186f4 g    DF .text  000001a4 ANativeActivity_onCreate

If it matters, using vs-android with toolchain 4.7.2, targeting 2.3.3 (android-10), for armv7-a. I have libraries that I include appropriately, and end up fully linking.

My one theory, which I'm still unable to prove, is that there are some .so files that I also need to include with the apk. I assumed that the external libraries (so) would be merged with my own. If this is not the case, this would likely explain the issue at hand.

I am not using any makefiles directly - vs-android is handling most of it. I only have access to some .xml and .property files.

Was it helpful?

Solution

It seems this error will come up ambiguously if there are dependant libraries that cannot be found. Since I'm using vs-android, I'm still unsure how to even get the external .so files to properly be included in the apk under the /libs/ path.

The only solution to include external .so files is to somehow get the libraries into your apk and link them manually within code, call System.loadLibrary() on the Java side before your native library gets loaded, or have one native library load the libraries and then launch your main library.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top