margelo / react-native-quick-sqlite

A fast react-native SQLite library built using JSI
https://margelo.io
MIT License
351 stars 27 forks source link

Failed android build with 8.2.0 on Expo SDK 51 #65

Open moritzlang opened 6 days ago

moritzlang commented 6 days ago

Version 8.2.0 causes the EAS android build to fail:

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
   > 2 files found with path 'lib/arm64-v8a/libjsi.so' from inputs:
      - /home/expo/workingdir/build/node_modules/react-native-quick-sqlite/android/build/intermediates/library_jni/debug/jni/arm64-v8a/libjsi.so
      - /home/expo/.gradle/caches/8.8/transforms/307dea209135b468612d0cc030606a8c/transformed/jetified-react-android-0.74.5-debug/jni/arm64-v8a/libjsi.so
     If you are using jniLibs and CMake IMPORTED targets, see
     https://developer.android.com/r/tools/jniLibs-vs-imported-targets

Project dependencies:

"expo": "~51.0.37"
"react-native": "0.74.5"
"react-native-quick-sqlite": "^8.2.0"

Any way to fix this?

chrispader commented 6 days ago

Looking into this!

obenov commented 6 days ago

Here is my patch and I managed to build it successfully (no Expo):

diff --git a/node_modules/react-native-quick-sqlite/android/build.gradle b/node_modules/react-native-quick-sqlite/android/build.gradle
index 4c3478b..5beed8f 100644
--- a/node_modules/react-native-quick-sqlite/android/build.gradle
+++ b/node_modules/react-native-quick-sqlite/android/build.gradle
@@ -61,6 +61,17 @@ android {
     }
   }

+  packagingOptions {
+      excludes = [
+          "META-INF",
+          "META-INF/**",
+          "**/libjsi.so",
+          "**/libc++_shared.so",
+          "**/libreact_nativemodule_core.so",
+          "**/libturbomodulejsijni.so"
+      ]
+    }
+
   buildFeatures {
     buildConfig true
     prefab true
Lipo11 commented 5 days ago

I think it makes more sense to pick first instead of exclude ( i think its necessary to keep all .so ) i added to my android/app/build.gradle into android object and its working now

packagingOptions {
    pickFirst "**/libjsi.so"
    pickFirst "**/libreact_nativemodule_core.so"
    pickFirst "**/libturbomodulejsijni.so"
}
yugantar7 commented 2 days ago

Looking into this!

Hi @chrispader! Did you get some time to look into this issue?