[React Native] 踩坑记录:
/SoLoader: couldn't find DSO to load: librealmreact.so caused by: dlopen failed: "/data/data/com/XXXX/lib-main/librealmreact.so" is 32-bit instead of 64-bit
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: librealmreact.so caused by: dlopen failed: "/data/data/com.xxx/lib-main/librealmreact.so" is 32-bit instead of 64-bit
React native expection java.lang.UnsatisfiedLinkError: dlopen failed: “/data/data/{package}/lib-main/libgnustl_shared.so” is 32-bit instead of 64-bit #11027
Android不能同时加载32和64位本机库。 如果您至少有一个依赖库使用ARM64支持编译的扩展,而另外一些依赖库仅支持ARM32,就会出现问题。 系统将检测ARM64依赖关系,加载它,然后拒绝加载仅ARM32的so库,就可能导致应用程序崩溃。
在project的root目录下的build.gradle中添加如下代码。
android {
...
defaultConfig {
...
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
}
参考:
https://blog.csdn.net/u013531824/article/details/53931307
https://github.com/facebook/react-native/issues/11027