冲突'META-INF/MANIFEST.MF'条目名称



描述

运行detox build -c android时,我一直收到以下错误

> 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

再现

  • 通过此处的步骤为android设置排毒(无需测试管家步骤(
  • 按照描述设置以下2个文件(减去我的依赖项(
  • 运行detox build -c android(无论是否先构建aosp模拟器(

我的文件

.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"
}
}
...

android/app.build.gradle

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

...
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"))
}
...

环境

  • 排毒:^17.14.3
  • React Native:0.63.2
  • com.android.tools.build:gradle:4.0.1
  • 节点:v12.19.0
  • 设备:Android AOSP像素模拟器API 28
  • 操作系统:MacOS Catalina v10.15.7
  • 试车手:笑话

其他可能有用的信息

  • Detox构建和运行测试适用于iOS,但不适用于android
  • 使用--stacktrace运行build命令不会提供任何进一步的信息
  • 这是我第一次尝试在这个项目上设置排毒
  • 排毒文档中列出的解决方案尚未修复
  • 我发现很多关于线程上相关错误的东西(尽管没有提到排毒(都与gradle版本有关。很多人建议降级
  • 我可以在普通的Pixel模拟器上构建实际的应用程序,并通过android studio使用build命令构建AOSP模拟器。仅当尝试通过detox-cli使用build命令时才会出现此问题

可能的修复方法是禁用Gradle插件3.6.0-alpha09中引入的zipfringer。只需在grade.propertiesandroid.useNewApkCreator=false中添加新行

在谷歌博客上阅读更多关于国旗的信息或查看类似的问题。

相关内容

最新更新