react-native-nitro-sqlite icon indicating copy to clipboard operation
react-native-nitro-sqlite copied to clipboard

Does not work with RN 0.74.1 or ExpoSDK 51.

Open RRaideRR opened this issue 1 year ago • 1 comments

I took a fresh Expo SDK 51 project with RN 0.74.1 installed and ran npx expo run:android. I got the following error message during the build process:

> Task :react-native-quick-sqlite:configureCMakeDebug[arm64-v8a] FAILED
C/C++: /Users/xxx/WebstormProjects/react-native-quick-sqlite/node_modules/react-native-quick-sqlite/android/CMakeLists.txt debug|arm64-v8a : com.google.prefab.api.NoMatchingLibraryException: No compatible library found for //ReactAndroid/fabricjni. Rejected the following libraries:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-quick-sqlite:configureCMakeDebug[arm64-v8a]'.
> [CXX1214] /Users/xxx/WebstormProjects/react-native-quick-sqlite/node_modules/react-native-quick-sqlite/android/CMakeLists.txt debug|arm64-v8a : User has minSdkVersion 21 but library was built for 23 [//ReactAndroid/fabricjni]

After that error message, I installed expo-build-properties and set the minSdkVersion to 23. However, the error message remained the same.

Minimal reproducible example: https://github.com/RRaideRR/react-native-quick-sqlite

RRaideRR avatar May 16 '24 13:05 RRaideRR

Same issue with the bare react-native app!

ductridev avatar May 16 '24 23:05 ductridev

The same way like author did and the same error

sivashik98 avatar May 23 '24 10:05 sivashik98

Moved to op-sqlite and success build with rn 0.74.1

ductridev avatar May 23 '24 10:05 ductridev

Any news on this please?

MehdiSv avatar May 29 '24 18:05 MehdiSv

you can create a patch: File name: patches/react-native-quick-sqlite+8.1.0.patch

content:

diff --git a/node_modules/react-native-quick-sqlite/android/build.gradle b/node_modules/react-native-quick-sqlite/android/build.gradle
index afcda02..2b8ea08 100644
--- a/node_modules/react-native-quick-sqlite/android/build.gradle
+++ b/node_modules/react-native-quick-sqlite/android/build.gradle
@@ -63,7 +63,7 @@ android {
   }

   defaultConfig {
-    minSdkVersion 21
+    minSdkVersion 23
     targetSdkVersion safeExtGet('targetSdkVersion', 28)
     versionCode 1
     versionName "1.0"

There is a PR fixing this issue waiting for merge

FelipeSSantos1 avatar May 29 '24 23:05 FelipeSSantos1

you can create a patch: File name: patches/react-native-quick-sqlite+8.1.0.patch

content:

diff --git a/node_modules/react-native-quick-sqlite/android/build.gradle b/node_modules/react-native-quick-sqlite/android/build.gradle
index afcda02..2b8ea08 100644
--- a/node_modules/react-native-quick-sqlite/android/build.gradle
+++ b/node_modules/react-native-quick-sqlite/android/build.gradle
@@ -63,7 +63,7 @@ android {
   }

   defaultConfig {
-    minSdkVersion 21
+    minSdkVersion 23
     targetSdkVersion safeExtGet('targetSdkVersion', 28)
     versionCode 1
     versionName "1.0"

There is a PR fixing this issue waiting for merge

I fixed the issue with patch-module, and be able to run it with npx expo run:android, but couldn't run it with npx Expo start. Anyone know why? or how to fix this issue?

ntuong196 avatar Jul 03 '24 02:07 ntuong196

This issue is fixed on main. I referenced the main branch directly from my package.json like this:

    "react-native-quick-sqlite": "github:margelo/react-native-quick-sqlite#main",

And now and Android CI build works without problems.

@mrousavy please release an npm upgrade so my yarns don't take forever.

michakfromparis avatar Jul 21 '24 17:07 michakfromparis

@ductridev op-sqlite does'nt support typeorm, to difficult to migrate big project to raw sql. Tried build work, but bot driver found for the late version.

If you have driver for last, please repleat me.

wogno avatar Jul 31 '24 14:07 wogno

@wogno so you should try above solutions, which can fix the problem.

ductridev avatar Jul 31 '24 14:07 ductridev

I was using this solution until the version 8.2.0 was releases. If I try to install the main link, it shows the error that I need to install the react-native-quick-sqlite dependency. If I use the 8.2.0 version, I get this error:

* 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:
      - /workspace/channels/node_modules/react-native-quick-sqlite/android/build/intermediates/library_jni/debug/jni/arm64-v8a/libjsi.so
      - /.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

Any clue how to suppress this error?

vitorcamachoo avatar Oct 10 '24 17:10 vitorcamachoo

I was using this solution until the version 8.2.0 was releases. If I try to install the main link, it shows the error that I need to install the react-native-quick-sqlite dependency. If I use the 8.2.0 version, I get this error:

* 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:
      - /workspace/channels/node_modules/react-native-quick-sqlite/android/build/intermediates/library_jni/debug/jni/arm64-v8a/libjsi.so
      - /.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

Any clue how to suppress this error?

IIRC, you need to clean all Android build folders (.cxx, build, ...) before building with the new version.

Running ./gradlew clean will not clean all files necessary. Probably best to clean the whole repo with git clean -xdf

chrispader avatar Oct 14 '24 06:10 chrispader

Forgot to mention that I am using expo 51 and they have the clean task.

Edit: Even after cleaning everything, the build for Android does not work because it find two files: jni/arm64-v8a/libjsi.so

vitorcamachoo avatar Oct 14 '24 07:10 vitorcamachoo

+1 using it without Expo. Same output (RN 0.75.4): 2 files found with path 'lib/arm64-v8a/libjsi.so' from inputs: - /Users/runner/work/1/s/node_modules/react-native-quick-sqlite/android/build/intermediates/library_jni/debug/copyDebugJniLibsProjectOnly/jni/arm64-v8a/libjsi.so - /Users/runner/.gradle/caches/transforms-4/b8a7f419199e0f7ddeded381c5a3e9cd/transformed/jetified-react-android-0.75.4-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

obenov avatar Oct 15 '24 07:10 obenov

Managed to patch the package and the build was successful:

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

obenov avatar Oct 15 '24 17:10 obenov

Any news on this please?

vitorcamachoo avatar Oct 22 '24 09:10 vitorcamachoo