I\'ve built the Assimp library as a shared library. I\'ve included it in my Android ndk project and it builds fine but when I load it I get the following error: Unable to lo
Using System.loadLibrary
is the way to go.
Android won't automatically load dependent shared libraries for you. So you need to do something like this:
static {
System.loadLibrary("assimp"); // dependency .so first
System.loadLibrary("native-activity"); // dependent .so second
}
This code usually goes in the class which contains the native Java methods (i.e. methods defined with keyword native
, which map through to native code). Because this code is executed in a static
block it is executed when the Java classloader loads the class -- i.e. before any code in the class actually gets executed.
You shouldn't have to add any reference to assimp
to LOCAL_LDLIBS
because you're already referencing assimp
via the LOCAL_SHARED_LIBRARIES
declaration.
This question may be relevant.