Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SoLoader$WrongAbiError with React Native Android

Recently we've integrated react native into our app with just hello world view. On some devices (mostly Asus) we're getting this crash.

Fatal Exception: com.facebook.soloader.SoLoader$WrongAbiError: APK was built for a different platform
       at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:253)
       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.NativeMap.<clinit>(NativeMap.java:22)
       at com.facebook.react.JSCConfig$1.getConfigMap(JSCConfig.java:14)
       at com.facebook.react.XReactInstanceManagerImpl.recreateReactContextInBackgroundFromBundleLoader(XReactInstanceManagerImpl.java:423)
       at com.facebook.react.XReactInstanceManagerImpl.recreateReactContextInBackgroundInner(XReactInstanceManagerImpl.java:419)
       at com.facebook.react.XReactInstanceManagerImpl.createReactContextInBackground(XReactInstanceManagerImpl.java:363)
       at com.facebook.react.ReactRootView.startReactApplication(ReactRootView.java:213)
       at com.eightfit.app.ui.fragments.ReactFragment.startReactApp(ReactFragment.java:107)
       at com.eightfit.app.ui.fragments.ReactFragment.onViewCreated(ReactFragment.java:88)
       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1123)
       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1286)
       at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:758)
       at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1671)
       at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:388)
       at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:619)
       at com.eightfit.app.ui.activities.MainActivity.onStart(MainActivity.java:150)
       at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
       at android.app.Activity.performStart(Activity.java:5241)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2197)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2273)
       at android.app.ActivityThread.access$800(ActivityThread.java:138)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1236)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:149)
       at android.app.ActivityThread.main(ActivityThread.java:5045)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610)
       at dalvik.system.NativeStart.main(NativeStart.java)
Caused by java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app-lib/com.eightfit.app-1/libreactnativejni.so" has unexpected e_machine: 40
       at java.lang.Runtime.load(Runtime.java:333)
       at java.lang.System.load(System.java:512)
       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.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.NativeMap.<clinit>(NativeMap.java:22)
       at com.facebook.react.JSCConfig$1.getConfigMap(JSCConfig.java:14)
       at com.facebook.react.XReactInstanceManagerImpl.recreateReactContextInBackgroundFromBundleLoader(XReactInstanceManagerImpl.java:423)
       at com.facebook.react.XReactInstanceManagerImpl.recreateReactContextInBackgroundInner(XReactInstanceManagerImpl.java:419)
       at com.facebook.react.XReactInstanceManagerImpl.createReactContextInBackground(XReactInstanceManagerImpl.java:363)
       at com.facebook.react.ReactRootView.startReactApplication(ReactRootView.java:213)
       at com.eightfit.app.ui.fragments.ReactFragment.startReactApp(ReactFragment.java:107)
       at com.eightfit.app.ui.fragments.ReactFragment.onViewCreated(ReactFragment.java:88)
       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1123)
       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1286)
       at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:758)
       at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1671)
       at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:388)
       at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:619)
       at com.eightfit.app.ui.activities.MainActivity.onStart(MainActivity.java:150)
       at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
       at android.app.Activity.performStart(Activity.java:5241)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2197)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2273)
       at android.app.ActivityThread.access$800(ActivityThread.java:138)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1236)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:149)
       at android.app.ActivityThread.main(ActivityThread.java:5045)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610)
       at dalvik.system.NativeStart.main(NativeStart.java)

In gradle we define Android NDK abi filter this way

ndk {
    abiFilters "armeabi", "armeabi-v7a", "mips", "x86"
}

We use React Native 0.35.0-rc.0 but we've been getting same crash also with stable release 0.33.1.

Asus devices affected use cpu abi armeabi-v7a. Most other devices with same abi seems working fine.

enter image description here

You can find full crash report here. https://gist.github.com/sealskej/5fc0c8e9092721d2be43b4d1ff3c60de

Any help leading to fixing issue would be much appreciated!

like image 827
sealskej Avatar asked Oct 10 '16 12:10

sealskej


1 Answers

I have the same problem as you. And I found that you should provide libraries optimized for each ABIs if possible, but it’s all in or nothing: you shall not mix. You have to provide the full set of the libraries you’re using in each ABI folder.In my project in armeabi-v7a dictionary are 32 .so files,but in x86 dictionary are 31 .so files.So the SoLoader may load the wrong file in x86 devices. You can see this link to learn more

like image 93
Lucky Avatar answered Nov 13 '22 04:11

Lucky