开发者

How to package native library in Android app?

开发者 https://www.devze.com 2023-03-13 10:07 出处:网络
I\'m trying unsuccessfully to include a pre-built library that uses native code in an Android app. I can\'t figure out what I\'m doing wrong.

I'm trying unsuccessfully to include a pre-built library that uses native code in an Android app. I can't figure out what I'm doing wrong.

The contents of the finished .apk file l开发者_开发百科ook as follows. (I'm using NetBeans and Ant to build everything - I can include the relevant parts of the Ant script if anybody wants it.)

META-INF
assets
libs >
    armeabi >
        libandroidgl20.so
        libgdx.so
res 
AndroidManifest.xml
classes.dex
resources.arsc

In the application code, I have:

static {
    System.loadLibrary("gdx");
    System.loadLibrary("androidgl20");
}

But I keep getting the error: java.lang.UnsatisfiedLinkError: Library gdx not found.

Am I putting the .so files in the right place? Do I need to do anything else to make sure the runtime is aware of them?


System.load() requires the exact path (including full name) to the shared object. This is what you're doing wrong.

Use System.loadLibrary("gdx"); instead.


Are you sure all the dependencies of 'gdx' are met ?
Is there any unimplemented native function in that library ?

0

精彩评论

暂无评论...
验证码 换一张
取 消