We are using ReactNative in our app. App is crashing with Fatal Exception: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/data/com.asda.android/lib-main/libgnustl_shared.so" is 32-bit instead of 64-bit only on Sony-Xperia device(Xperia XA/Android 7). Its not happening on other devices
we have removed the 64 bit versions of api from apk by adding following things in build.gradle
android {
compileSdkVersion 27
buildToolsVersion '27.0.2'
flavorDimensions "default"
…….
defaultConfig {
...
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
packagingOptions {
……
exclude '/lib/mips64/**'
exclude '/lib/arm64-v8a/**'
exclude '/lib/x86_64/**'
}
…….
}
Scanning folders for symlinks in /Users/vn0zpn2/ern_workspace/asda-ern-miniapps/DMTMiniApp/node_modules (5ms)
Environment:
OS: macOS Sierra 10.12.6
Node: 9.3.0
Yarn: 1.3.2
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: Not Found
Packages: (wanted => installed)
react: 16.0.0 => 16.0.0
react-native: 0.51.0 => 0.51.0
Its happening in production. We are using the Litho along with React native(version: 0.51.0)
build.gradle
App Launch.
Should not crash on app launch
Crashes with log below
Fatal Exception: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/data/com.asda.android/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.SoLoader.loadLibrary(SoLoader.java:247)
at com.facebook.react.bridge.ReactBridge.staticInit(ReactBridge.java:20)
at com.facebook.react.bridge.NativeMap.(NativeMap.java:21)
at com.facebook.react.bridge.JSCJavaScriptExecutorFactory.create(JSCJavaScriptExecutorFactory.java:23)
at com.facebook.react.ReactInstanceManager$4.run(ReactInstanceManager.java:928)
at java.lang.Thread.run(Thread.java:761)
Thanks for posting this! It looks like your issue may be missing some necessary information. Can you run react-native info and edit your issue to include these results under the Environment section?
Thank you for your contributions.
updated..
I have the same problem with Samsung s7 and s8
Same problem here.
It seems that the quick fix is remove 64 bit builds and target only to 32 bit binaries. Naturally, this isn't a sustainable way, but helps a lot when you have a deadline. I hope there will be a general solution for this soon. Google will require 64 bit builds from the beginning of next year.
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.
Hello, is there any update on this issue ?
@mindhivefi Could you please provide an example?
It looks like this issue has gotten quite stale. With 64-bit now available in master, I am going to close this and request anybody running into something similar to please open a new issue.
Wow, ran into this just now and can't believe this was closed just 17 hours ago with no resolution.
I am sorry you ran into this issue with such poor timing. Please do open a new issue as advised.
Since I forgot to post a solution for the problem:
One of my dependencies shipped their own libgnustl_shared.so which was overwriting the one provided by react-native. I resolved this by moving implementation "com.facebook.react:react-native:+" as high up as possible and tewaking the packagingOptions
HOWEVER I did not upgrade to the newest version with 64bit support yet so you might want to ditch the exclude everything 64bit related section.
app/build.gradle
...
android {
...
packagingOptions {
// exclude everything 64bit related
exclude '/lib/mips64/**'
exclude '/lib/arm64-v8a/**'
exclude '/lib/x86_64/**'
// com.thirdparty:spotify-player:24 ships their own .so files
// we do not want those
pickFirst '/lib/x86/libgnustl_shared.so'
pickFirst '/lib/armeabi-v7a/libgnustl_shared.so'
}
}
dependencies {
...
implementation "com.facebook.react:react-native:+"
...
implementation 'com.thirdparty:spotify-player:24'
}
Maybe this can help someone. You should start by analysing your dependencies (e.g. if this causes the issue you are facing), before applying this fix.
defaultConfig {
ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
packagingOptions {
exclude '/lib/mips64/**'
exclude '/lib/arm64-v8a/**'
}
}
this worked for me
defaultConfig { ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64' packagingOptions { exclude '/lib/mips64/**' exclude '/lib/arm64-v8a/**' } }this worked for me
Did it worked in play store?
yes it worked.
yes it worked.
just once, then failed again. sad!
yes it worked.
just once, then failed again. sad!
what is the error?
yes it worked.
just once, then failed again. sad!
what is the error?
Doesn't work anymore on Playstore :'(
yes it worked.
just once, then failed again. sad!
what is the error?
Doesn't work anymore on Playstore :'(
what is exact issue? is it uploading apk or running?
yes it worked.
just once, then failed again. sad!
what is the error?
Doesn't work anymore on Playstore :'(
what is exact issue? is it uploading apk or running?
It's running alright, but Playstore won't accept it because of the 64 bit issue.
i got the same error when running and uploading to playstore. and above code helped me. and my app now on live.
What is your RN version ??? @russelRajitha
0.55.2
Using RN 0.60.5 version.
If you guys are wondering why your app crashes if you download it from playstore, make the below changes
packagingOptions {
exclude '/lib/mips64/'
exclude '/lib/arm64-v8a/'
exclude '/lib/x86_64/'
//In pickFirst, replace the library name with the library that is causing error.
pickFirst '/lib/x86/libc++_shared.so' (pickFirst '/lib/x86/error_causing_library.so')
pickFirst '/lib/armeabi-v7a/libc++_shared.so' (pickFirst '/lib/armeabi-v7a/error_causing_library.so')
}**
REASON - We are excluding all 64 bit libraries so that OS will not have confusion of which library to pick.
If you do not know which library is causing the crash, upload your bundle in Firebase test lab and then check. It will tell you which library is throwing the error
For those who still have difficulty
Problem:
The Play Store from August 1 onwards has changed its compliance criteria for 32-bit and 64-bit applications, and 64-bit versions are required.
We always send apk to "armeabi-v7a", "x86" and "x86_64" 32-bit and 64-bit) based operating systems which always worked and always went into confirmation at the time of publication, but in this week's post, Google rejected it, claiming that the 64-bit settings were missing. This issue began to be reported in the community on August 20.
CAUSE:
The architecture that google is obliging to add is "arm64-v8a" (64 bit) but when added google accepts but the application breaks on certain devices using this architecture but does not break on "x86_64" based devices ( 64-bit too), so some work and some don't.
** some times the directory lib/x86_64 and lib/arm64-v8a is empty or missing some libraries inside to apk file
SOLUTION:
For who use 0.57.1 or less
Properly add architecture by updating all application dependencies, including updating version of "[email protected]" and main library "[email protected]", so android now supports the "armeabi-v7a", "arm64-v8a", "x86", "x86_64" architectures.
after in your build.gradle file update the code.
** "pickFirst" set the library that is causing the problem
....
ndk {
abiFilters 'armeabi-v7a', 'armeabi','arm64-v8a','x86','x86_64'
}
packagingOptions {
exclude "lib/arm64-v8a/libgnustl_shared.so"
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libjsc.so'
pickFirst 'lib/arm64-v8a/libjsc.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
}
....
I am using react-native version 56.0 I am able to build apk but when I try to upload in play store it doesn't work. what should i do
here is my build.gradlew
` compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.christenpro"
minSdkVersion 16
targetSdkVersion 27
versionCode 32
versionName "2.24"
vectorDrawables.useSupportLibrary = true
ndk {
abiFilters "armeabi-v7a", "x86"
}
multiDexEnabled = true
dexOptions {
jumboMode true
javaMaxHeapSize "4g"
// preDexLibraries = false
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.getRequested().getGroup() == 'com.google.android.gms') {
details.useVersion('15.0.1')
}
}
}
}`
I am using react-native version 56.0 I am able to build apk but when I try to upload in play store it doesn't work. what should i do
here is my build.gradlew
` compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.christenpro"
minSdkVersion 16
targetSdkVersion 27
versionCode 32
versionName "2.24"vectorDrawables.useSupportLibrary = true ndk { abiFilters "armeabi-v7a", "x86" } multiDexEnabled = true dexOptions { jumboMode true javaMaxHeapSize "4g" // preDexLibraries = false }configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.getRequested().getGroup() == 'com.google.android.gms') {
details.useVersion('15.0.1')
}
}
}
}`
Our ultimate fix was to upgrade to 0.59 react-native version to support 64 bit androids
Most helpful comment
defaultConfig { ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64' packagingOptions { exclude '/lib/mips64/**' exclude '/lib/arm64-v8a/**' } }this worked for me