Skip to content Skip to sidebar Skip to footer

Android System.loadLibrary Stalls While Loading Native Library

I have a rather large shared library file (= 12megabytes) which does not contain any JNI code whatsoever. When calling System.loadLibrary('some_file') the method never returns and

Solution 1:

I found the solution to the problem myself. I did not use any additional debug tools, but left out some code that was run when the library loaded. The particular code hanged, making System.loadLibrary hang as well.


Solution 2:

Adding my solution in case someone else run into the problem. The problem was with some external dependencies (OpenSceneGraph) that were loaded statically in our library. They were only hanging on Android 4.0 and it was running fine 4.2 and up.

So if you have the problem, put a __android_log_print in the JNI_onLoad of your library (if you have one). If it is not called, check all the functions that can be called statically (beware, some might be hidden behind macros) and try to remove them to see if your able to load the library then.


Post a Comment for "Android System.loadLibrary Stalls While Loading Native Library"