.so is compatible with 32-bit and 64-bit

The compatibility of Android is a very troublesome problem. I encountered it again in the past few days. Fortunately, it was solved.

The problem I encountered is that I downloaded a function library on the Internet, which brought a xxx.so dynamic library, the problem is that it is 32-bit. However, when I took an arm-64-bit mobile phone for testing two days earlier, I found that it actually crashed! Tears broke for a long time...

 

At first the error message was:
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.xxx.xxx-1/base.apk"],nativeLibraryDirectories=[/data/app/ com.xxx.xxx-1/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "xxx.so",
luckily I found a solution:

1.在build.gradle中配置如下:android {    ...defaultConfig {....ndk {moduleName"native"abiFilters"armeabi","armeabi-v7a","x86","mips"}    }    ...}













2. Configure android.useDeprecatedNdk = true in gradle.properties

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326589152&siteId=291194637