条目名称“META-INF/MANIFEST.MF”发生冲突

问题描述

说明

我在运行 admin 时不断收到以下错误

detox build -c android

重现

  • 按照步骤 here 为 android 设置排毒(没有测试管家步骤)
  • 按照描述设置以下 2 个文件(减去我的依赖项)
  • 运行 > Task :app:packageDebugAndroidTest Failed FAILURE: Build Failed with an exception. * What went wrong: Execution Failed for task ':app:packageDebugAndroidTest'. > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade > Entry name 'meta-inf/MANIFEST.MF' collided (无论是否先构建了 aosp 模拟器)

我的文件

detox build -c android

.detoxrc.json

{ ... "android": { "binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk","build": "cd android && ./gradlew app:assembleDebug app:assembleAndroidTest -DtestBuildType=debug && cd ..","type": "android.emulator","device": { "avdName": "Pixel_API_28_AOSP" } } ...

前 3 个选项是解决问题的失败尝试。在尝试安装 Detox 之前,最后一个选项已经存在于项目中。

android/app.build.gradle

环境

  • 排毒:^17.14.3
  • 反应原生:0.63.2
  • com.android.tools.build:gradle: 4.0.1
  • 节点:v12.19.0
  • 设备:Android AOSP 像素模拟器 API 28
  • 操作系统:MacOS Catalina v10.15.7
  • 测试运行器:jest

其他可能有用的信息

  • Detox 为 iOS 构建和运行测试良好,但不适用于 android
  • 使用 ... android { ... packagingOptions { // exclude 'meta-inf/**' // pickFirst 'meta-inf/**' // merge 'meta-inf/**' pickFirst "**" } ... } dependencies { implementation filetree(dir: "libs",include: ["*.jar"]) //noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:+" // From node_modules implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" implementation 'com.facebook.fresco:animated-gif:2.0.0' debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { exclude group:'com.facebook.fbjni' } debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { exclude group:'com.facebook.flipper' exclude group:'com.squareup.okhttp3',module:'okhttp' } debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { exclude group:'com.facebook.flipper' } addUnimodulesDependencies() if (enableHermes) { def hermesPath = "../../node_modules/hermes-engine/android/"; debugImplementation files(hermesPath + "hermes-debug.aar") releaseImplementation files(hermesPath + "hermes-release.aar") } else { implementation jscFlavor } androidTestImplementation('com.wix:detox:+') androidTestImplementation(project(path: ":detox")) } ... 运行构建命令不会提供任何进一步的信息
  • 这是我第一次尝试在这个项目中设置排毒
  • detox docs 中列出的解决方案尚未修复
  • 我发现很多关于线程相关错误内容(尽管没有提到 detox)都与 gradle 版本有关。很多人建议降级。
  • 我可以通过 android studio 使用 build 命令在普通 Pixel 模拟器和 AOSP 模拟器上构建实际应用程序。此问题仅在尝试通过 --stacktrace
  • 使用构建命令时发生

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)