异常
java.lang.UnsatisfiedLinkError: dlopen failed: "/data/data/xxx/lib-main/libgnustl_shared.so" is 32-bit instead of 64-bit
at java.lang.Runtime.load0(Runtime.java:897)
at java.lang.System.load(System.java:1505)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:71)
at com.facebook.soloader.DirectorySoSource.loadLibrary(DirectorySoSource.java:42)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:299)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:65)
at com.facebook.soloader.DirectorySoSource.loadLibrary(DirectorySoSource.java:42)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:299)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:65)
at com.facebook.soloader.DirectorySoSource.loadLibrary(DirectorySoSource.java:42)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:299)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:65)
at com.facebook.soloader.DirectorySoSource.loadLibrary(DirectorySoSource.java:42)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:299)
at com.facebook.soloader.DirectorySoSource.loadLibraryFrom(DirectorySoSource.java:65)
at com.facebook.soloader.DirectorySoSource.loadLibrary(DirectorySoSource.java:42)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:299)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:247)
at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:24)
at com.facebook.react.bridge.ReactBridge.<clinit>(ReactBridge.java:20)
at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:24)
at com.facebook.react.bridge.NativeMap.<clinit>(NativeMap.java:22)
at com.facebook.react.JSCConfig$1.getConfigMap(JSCConfig.java:14)
at com.facebook.react.ReactInstanceManager.recreateReactContextInBackgroundFromBundleLoader(ReactInstanceManager.java:450)
at com.facebook.react.ReactInstanceManager.access$1300(ReactInstanceManager.java:108)
at com.facebook.react.ReactInstanceManager$3$1.run(ReactInstanceManager.java:435)
at android.os.Handler.handleCallback(Handler.java:754)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:163)
at com.mazaiting.crash.CrashHandler$2.run(CrashHandler.java:64)
at android.os.Handler.handleCallback(Handler.java:754)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6359)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)
异常.png
libgnustl_shared.so is 32-bit instead of 64-bit类似错误
解决方法:
- 在项目的根目录的 gradle.properties 里面添加一行代码
android.useDeprecatedNdk=true
- 在 build.gradle 文件里添加以下代码
android {
...
defaultConfig {
...
ndk {
abiFilters "armeabi-v7a", "x86"
}
packagingOptions {
exclude "lib/arm64-v8a/librealm-jni.so"
}
}
}