React-native integreted into existing android apk is giving crash in Asus Zenphone 5. react-native version used : 0.19
java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app-lib/com.caratlane.android-1/libreactnativejni.so" has unexpected e_machine: 40
E/AndroidRuntime(31481): at java.lang.Runtime.load(Runtime.java:333)
E/AndroidRuntime(31481): at java.lang.System.load(System.java:512)
E/AndroidRuntime(31481): at com.facebook.soloader.DirectorySoSource.loadLibrary(DirectorySoSource.java:63)
E/AndroidRuntime(31481): at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:209)
E/AndroidRuntime(31481): at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:178)
E/AndroidRuntime(31481): at com.facebook.react.bridge.NativeMap.
Hey anishakd4, thanks for reporting this issue!
React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
- If you don't know how to do something or something is not working as you expect but not sure it's a bug, please ask on StackOverflow with the tag
react-nativeor for more real time interactions, ask on Discord in the #react-native channel. - If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
- We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!
Are you running a release build for ARM devices on an x86 device by chance? You can check this by unzipping your .apk file and checking the libs/x86 folder. It should be present and contain .so files.
I did not know Android was running on x86 devices but the Zenphone 5 is one.
https://www.asus.com/Phone/ZenFone_5_A500CG/
Chipset Intel Atom Z2580 CPU Dual-core 2.0 GHz GPU PowerVR SGX544MP2
@mkonicek Asus Zenphone 5 is x86 device. I generated 3 release builds : x86 release apk, ARM release apk and universal apk. Universal apk is giving above mentioned crash in Asus zenphone 5(x86 device).
Yeah @esutton Asus phones are powered by INTEL. x86 release apk works fine on ASUS phone. But i don't want to use split android apks. I thought universal apk should run on both "ARM" and "x86" devices.
@mkonicek and @esutton can you suggest something. My company has fixed release date in next week. Can universal apk run on both "ARM" an "x86" platform??
The universal APK should work on x86 devices although I haven't tested it on an x86 device.
Can you try disabling the split APK builds in your build.gradle? https://github.com/facebook/react-native/blob/master/local-cli/generator-android/templates/src/app/build.gradle#L71
That way you should get only one APK, is it any different from the universal one?
@mkonicek universal apk gives crash on ASUS phone(intel powered x86 devices) . Only split apks based on CPU architecture works fine. I have already tried by disabling split apk.
@anishakd4 Are you saying the x86 APK works fine for you? In that case you can publish two APKs to the Play Store - ARM, x86 (and don't publish the universal APK). Everything should be fine then. Correct?
@mkonicek Yeah thats ok I can ship two APKs. But universal APK should work on both the platforms. We already have two Apps like facebook and messenger for my company. Now if I ship two APKs then it would mean that I will be shipping four APKs for each release. So can you confirm by trying yourself whether universal APK works in ASUS phone or not??
I agree the universal APK should work on x86 phones although I don't have an Asus phone so not sure this bug is specific to Asus. Do you know if the same issue occurs on other x86 phones by chance?
I'm swamped by several other things but long term we should either figure out how to make the universal APKs work on all phones or always build split APKs. If anyone has bandwidth to look into this that would be awesome! A workaround for now would be to ship those two APKs for each of your apps :(
@corbt I think you've run into some issues with x86 devices in the past?
@mkonicek no, I've worked with arm64 devices but not x86 (#2814). It doesn't sound to me like this bug is related, although I can't be sure.
@anishakd4 does your app have other native code/dependencies as well? If you can figure out exactly what combination of native dependencies causes this issue, that may help. Is it possible to reproduce with an emulator?
Ah OK, thanks for looking @corbt!
need help from @corbt
@corbt and @mkonicek I created a basic app as mentioned in react-native getting started website, and it is not working in Asus Zenphone 5.
@corbt and @mkonicek i use ASUS_T00F , android 4.4.2 and it's not working.
Hmm @anishakd4 that's a bad sign. Would you mind trying to download/run the Facebook Groups app from the Play Store on your Asus Zenphone 5? That's a production Facebook app built with React Native, so that should give us an idea if the problem is a fundamental problem with the way RN for Android is currently packaged or just a misconfiguration/3rd party compatibility issue.
hi @corbt , i used ASUS_T00F , android 4.4.2 and it's working with the Facebook Groups app, I downloaded from the Play store, and the version is 50.1.0.50.78
@corbt , @devonEdison and @mkonicek Facebook Groups app is using split apks based on CPU architecture thats why it is working. My issue is still the same that universal apk should work on x86 and arm devices both but it is not working on ASUS Zenphone 5 mobile. If you extract the Facebook Groups apk file then you will see that they are using split apks based on CPU architecture.
ok @anishakd4 that's right, I forgot that you mentioned that earlier. At least there's a workaround then (using split builds). Since neither myself nor anyone in this thread has access to a Zenphone 5, it would be good if you could figure out what needs to be changed to make universal builds work on x86, and then we can talk about merging it. Sorry that I've got nothing more concrete.