Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detox android test failed #321

Closed
Vick04 opened this issue Mar 22, 2023 · 0 comments · Fixed by #336
Closed

Detox android test failed #321

Vick04 opened this issue Mar 22, 2023 · 0 comments · Fixed by #336

Comments

@Vick04
Copy link

Vick04 commented Mar 22, 2023

Describe the bug
I have the following error when I try to run Detox tests on android.

`* What went wrong:
Execution failed for task ':react-native-mmkv-storage: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:
- /MY_PROJECT/node_modules/react-native-mmkv-storage/android/build/intermediates/library_jni/debug/jni/arm64-v8a/libc++_shared.so
- /home/jmzp/.gradle/caches/transforms-3/c22b30f4dea7b051abf86a530555f13b/transformed/jetified-react-android-0.71.4-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`

To Reproduce
Steps to reproduce the behavior:

  1. Migrate a RN project 0.66.5 to 0.71.4
  2. Install Detox following the official documentation
  3. Run detox build --configuration android.emu.debug

Platform Information:

  • React Native 0.71.4

Additional context
I was able to fix it by creating this patch:

diff --git a/node_modules/react-native-mmkv-storage/android/build.gradle b/node_modules/react-native-mmkv-storage/android/build.gradle
index 7b6e1b1..cb45fe4 100644
--- a/node_modules/react-native-mmkv-storage/android/build.gradle
+++ b/node_modules/react-native-mmkv-storage/android/build.gradle
@@ -36,6 +36,13 @@ repositories {
 android {
   compileSdkVersion safeExtGet("compileSdkVersion", 31)
 
+  packagingOptions {
+    pickFirst 'lib/x86/libc++_shared.so'
+    pickFirst 'lib/x86_64/libc++_shared.so'
+    pickFirst 'lib/arm64-v8a/libc++_shared.so'
+    pickFirst 'lib/armeabi-v7a/libc++_shared.so'
+  }
+
   buildFeatures {
     prefab true
   }

I hope this will be useful for the next update.

Greets!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant