当前位置: 首页 > 工具软件 > ki4so > 使用案例 >

android aar找不到so,Import Android AAR with JNI so files

温峻熙
2023-12-01

Trying to import AAR as module 'my-java-module' which contains a /jni/x86 folder with two .so files. When using the classes from the module, I was getting error saying:

W/System.err: Native code library (javamodule) failed to load.

W/System.err: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/com.google.android.things.jar", zip file "/data/app/com.test.app-a3ZcweiV8k7NhpzM3KSjc==/base.apk"],nativeLibraryDirectories=[/data/app/com.test.app-a3ZcweiV8k7NhpzM3KSjc==/lib/arm, /system/lib, /vendor/lib]]] couldn't find "libjavamodule.so"

So I change module name to 'javamodule' and it loads but now gives no implementation error:

E/zygote: No implementation found for void module_function()

Question: How do I tell Android to load the /lib/x86 .so files from the AAR module that was imported so that it finds the implementation?

 类似资料: