jsc-android-buildscripts: 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

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 18
  • Comments: 27

Most upvoted comments

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

The solution is in README.md.

In android/app/build.gradle add the following under android:

android {
    ...
+   packagingOptions {
+       pickFirst '**/libjsc.so'
+   }
}

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

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 .

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?

add this to app/build.gradle packagingOptions { pickFirst ‘lib/x86/libswscale.so’ pickFirst ‘lib/x86/libavcodec.so’ pickFirst ‘lib/x86/libavformat.so’ pickFirst ‘lib/x86/libavutil.so’ pickFirst ‘lib/x86_64/libavutil.so’ pickFirst ‘lib/x86_64/libavcodec.so’ pickFirst ‘lib/x86_64/libswscale.so’ pickFirst ‘lib/x86_64/libavformat.so’ pickFirst ‘lib/arm64-v8a/libavcodec.so’ pickFirst ‘lib/arm64-v8a/libavformat.so’ pickFirst ‘lib/arm64-v8a/libavutil.so’ pickFirst ‘lib/arm64-v8a/libswscale.so’ pickFirst ‘lib/armeabi-v7a/libavutil.so’ pickFirst ‘lib/armeabi-v7a/libavformat.so’ pickFirst ‘lib/armeabi-v7a/libavcodec.so’ pickFirst ‘lib/armeabi-v7a/libswscale.so’

}

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 😄

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?

@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

This issue is closed but wanted to share what I discovered that you can also use pickFirsts = [...] instead of multiple pickFirst.

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

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.

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

Worked for me, thanks !!!

@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?