Android build starts failing after updating to RN 0.58
Issue Description
Followed the instructions at https://github.com/react-native-community/jsc-android-buildscripts#how-to-use-it-with-my-react-native-app and was able to get it to build for RN 0.57. After updating to RN 0.58, react-native run-android starts failing with the following error
> Task :app:transformNativeLibsWithMergeJniLibsForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformNativeLibsWithMergeJniLibsForDebug'.
> More than one file was found with OS independent path 'lib/x86_64/libjsc.so'
Version, config, any additional info
236355.1.1
+1
The solution is in README.md.
In android/app/build.gradle add the following under android:
android {
...
+ packagingOptions {
+ pickFirst '**/libjsc.so'
+ }
}
@experiment322 thanks for pointing that out. This fixed the build issue.
Had the same issue in a clean project using react-native 0.58.3 and jsc 236355.1.1, the README suggest to add:
packagingOptions {
pickFirst '**/libgnustl_shared.so'
}
This didn't work for me, but the solution provided by @experiment322 did.
@rvolution are you sure your app is actually using jsc 236355? I suspect it's not, and you just didn't notice. Do native Proxy objects work?
@jshearer I don't use proxies directly in my app but i'm using MobX 5 and it's working fine.
This is the error that i got when attempting to compile:
More than one file was found with OS independent path 'lib/x86_64/libjsc.so'
It was resolved by adding:
packagingOptions {
pickFirst '**/libjsc.so'
}
It seems that at some moment this was on the readme, but currently it provides a solution for a similar conflict with a different file armeabi-v7a/libgnustl_shared.so
This should be added to the readme to save others gradle noobs like me of the struggle :)
I have tried everything above mentioned, but it's still not working for me. react-native: 0.58.3 jsc-android: 236355.1.1 and MobX 5
any updates on this? Thanks.
I had to use:
packagingOptions {
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'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
}
if that helps
packagingOptions { 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' pickFirst 'lib/armeabi-v7a/libc++_shared.so' }
This worked for me, thx @nonotest :D
I had to use:
packagingOptions { 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' pickFirst 'lib/armeabi-v7a/libc++_shared.so' }if that helps
Worked for me, thanks !!!
Hi the packagingOptions solution works when assembling debug builds with:
./gradlew assembleDebug
However it doesn't seem to work when assembling a test build with:
./gradlew assembleAndroidTest
Anybody here knows the subtleties between assembling a debug build and assembling a test build in gradle? Is there a workaround for this?
I had to use:
packagingOptions { 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' pickFirst 'lib/armeabi-v7a/libc++_shared.so' }if that helps
This worked for me Thx!!!
I had to use:
packagingOptions { 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' pickFirst 'lib/armeabi-v7a/libc++_shared.so' }if that helps
This worked for me. Thank you so much.
packagingOptions { 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' pickFirst 'lib/armeabi-v7a/libc++_shared.so' }
I had to use:
packagingOptions { 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' pickFirst 'lib/armeabi-v7a/libc++_shared.so' }if that helps
It's worked for me
This issue is closed but wanted to share what I discovered that you can also use pickFirsts = [...] instead of multiple pickFirst.
Hi the
packagingOptionssolution works when assembling debug builds with:
./gradlew assembleDebugHowever it doesn't seem to work when assembling a test build with:
./gradlew assembleAndroidTestAnybody here knows the subtleties between assembling a debug build and assembling a test build in gradle? Is there a workaround for this?
@sxqnicholas96 Did you find anything to fix assembleAndroidTest using this method?
I had to use:
packagingOptions { 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' pickFirst 'lib/armeabi-v7a/libc++_shared.so' }if that helps
This helped me too RN 0.60.5
I had to use:
packagingOptions { 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' pickFirst 'lib/armeabi-v7a/libc++_shared.so' }if that helps
great!!! thanks a lot. it helped me. RN 0.60.5
I had to use:
packagingOptions { 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' pickFirst 'lib/armeabi-v7a/libc++_shared.so' }if that helps
It's worked for me. RN 0.61.2 .