margelo / react-native-bignumber

🔢 The fastest Big Number library for React Native
https://margelo.io
MIT License
342 stars 12 forks source link

Android build crashes because of duplicate libssl.so #51

Closed Ferossgp closed 1 year ago

Ferossgp commented 2 years ago
* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
   > 2 files found with path 'lib/x86_64/libssl.so' from inputs:
      - .../node_modules/react-native-bignumber/android/build/intermediates/library_jni/debug/jni
      - .../.gradle/caches/transforms-3/63e67c36e7887bc75ff2c57fc2a952d6/transformed/jetified-flipper-0.138.0/jni
     If you are using jniLibs and CMake IMPORTED targets, see
     https://developer.android.com/r/tools/jniLibs-vs-imported-targets

I managed to have it fixed locally with a patch, but I'm not familiar with the implications in projects which do not have libssl from other dependencies.

diff --git a/android/build.gradle b/android/build.gradle
index a5dafe8..115c78d 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -118,7 +118,7 @@ android {
   }
     packagingOptions {
         jniLibs {
-            excludes += ['**/libc++_shared.so', '**/libfbjni.so', '**/libreactnativejni.so', '**/libjsi.so']
+            excludes += ['**/libc++_shared.so', '**/libfbjni.so', '**/libreactnativejni.so', '**/libjsi.so', '**/libssl.so']
         }
         resources {
             excludes += ['**/MANIFEST.MF']
sunnylqm commented 2 years ago

use pickFirst

awojciak commented 2 years ago

add

packagingOptions { pickFirst 'lib/x86/libssl.so' pickFirst 'lib/x86_64/libssl.so' pickFirst 'lib/armeabi-v7a/libssl.so' pickFirst 'lib/arm64-v8a/libssl.so' pickFirst 'lib/x86/libcrypto.so' pickFirst 'lib/x86_64/libcrypto.so' pickFirst 'lib/armeabi-v7a/libcrypto.so' pickFirst 'lib/arm64-v8a/libcrypto.so' } inside "android { ... }" in './android/app/build.gradle' in your project