expo / expo

An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
https://docs.expo.dev
MIT License
32.73k stars 5.21k forks source link

[expo-sqlite] Android test builds fail (task :expo:mergeDebugAndroidTestNativeLibs) #28887

Open oldratip opened 4 months ago

oldratip commented 4 months ago

Minimal reproducible example

https://github.com/oldratip/expo-sqlite-android-testbuild-error

What platform(s) does this occur on?

Android

Did you reproduce this issue in a development build?

Yes

Summary

Simply adding expo-sqlite to the project creates an issue with the Android test build.

To reproduce:

  1. Clone the example repo.
  2. npm install
  3. Create test build: cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug (note: this also occurs with the release variant of the test build).
  4. During the build process, the following error appears:
> Task :expo:mergeDebugAndroidTestNativeLibs FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':expo:mergeDebugAndroidTestNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
   > 2 files found with path 'lib/arm64-v8a/libc++_shared.so' from inputs:
      - /Users/oldratip/expo_projects/expo-sqlite-android-testbuild-error/node_modules/expo-sqlite/android/build/intermediates/library_jni/debug/jni/arm64-v8a/libc++_shared.so
      - /Users/oldratip/.gradle/caches/transforms-4/9bfd8d8ccf6aec4b45fb273f99ca2fd0/transformed/jetified-react-android-0.74.1-debug/jni/arm64-v8a/libc++_shared.so
     If you are using jniLibs and CMake IMPORTED targets, see
     https://developer.android.com/r/tools/jniLibs-vs-imported-targets

The non-test build of the app works without problems.

The example repo was created as follows:

A similar issue was reported a while back for expo-av: https://github.com/expo/expo/issues/20224

Thanks for your support.

Environment

expo-env-info 1.2.0 environment info: System: OS: macOS 14.4.1 Shell: 5.9 - /bin/zsh Binaries: Node: 20.13.1 - ~/.nvm/versions/node/v20.13.1/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 10.5.2 - ~/.nvm/versions/node/v20.13.1/bin/npm Watchman: 2024.04.15.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.15.2 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 23.5, iOS 17.5, macOS 14.5, tvOS 17.5, visionOS 1.2, watchOS 10.5 Android SDK: API Levels: 30, 31, 32, 33, 34 Build Tools: 30.0.2, 30.0.3, 32.0.0, 33.0.1, 34.0.0, 35.0.0 System Images: android-32 | Google APIs ARM 64 v8a, android-33 | Google Play ARM 64 v8a IDEs: Android Studio: 2023.3 AI-233.14808.21.2331.11709847 Xcode: 15.4/15F31d - /usr/bin/xcodebuild

Expo Doctor Diagnostics

✔ Check Expo config for common issues ✔ Check package.json for common issues ✔ Check dependencies for packages that should not be installed directly ✔ Check for common project setup issues ✔ Check npm/ yarn versions ✔ Check for issues with metro config ✔ Check Expo config (app.json/ app.config.js) schema ✔ Check native tooling versions ✔ Check for legacy global CLI installed locally ✔ Check that native modules do not use incompatible support packages ✔ Check that packages match versions required by installed Expo SDK ✔ Check that native modules use compatible support package versions for installed Expo SDK

Didn't find any issues with the project!

roggyboy commented 3 months ago

I'm also getting this error. Is there any known workarounds?

Tomus69 commented 2 months ago

I have the same problem Any solutions?

PAC-X commented 1 month ago

I have the same situation. I would appreciate any solutions to this.

Tomus69 commented 1 month ago

I've found this alternative solution that isn't an expo package: op-sqlite It's reliably testable and performs much better than expo-sqlite.

kennethjuulwannebo commented 2 weeks ago

I have the same issue.