gpt4 book ai didi

java - Android 项目失败 (React Native) - 任务 ':app:packageDebug' 执行失败 APK META-INF/LICENSE 中复制的重复文件

转载 作者:行者123 更新时间:2023-11-30 01:11:02 24 4
gpt4 key购买 nike

刚从 React Native .26 升级到 .29,在尝试运行我的 Android 项目时出现以下错误。我已经找到那些文件并更改了名称、移动了文件夹等。它们在每次构建时都被重建和复制。知道这可能是从哪里发生的吗?

... ... :app:preDexDebug UP-TO-DATE :app:dexDebug UP-TO-DATE :app:validateDebugSigning :app:packageDebug Error: duplicate files during packaging of APK /Users/nhyland/Documents/react-native/BidSmart/android/app/build/outputs/apk/app-debug-unaligned.apk Path in archive: META-INF/LICENSE Origin 1: /Users/nhyland/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.4.1/b130bcfb5a9c410c3cbd2e0adec9437e69a39e2c/jackson-core-2.4.1.jar Origin 2: /Users/nhyland/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-annotations/2.4.1/55605135bd7b836612e0bba7037c9669f6ccf89f/jackson-annotations-2.4.1.jar You can ignore those files in your build.gradle: android {
packagingOptions { exclude 'META-INF/LICENSE' } } :app:packageDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:packageDebug'.

    Duplicate files copied in APK META-INF/LICENSE File 1: /Users/nhyland/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.4.1/b130bcfb5a9c410c3cbd2e0adec9437e69a39e2c/jackson-core-2.4.1.jar File 2: /Users/nhyland/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-annotations/2.4.1/55605135bd7b836612e0bba7037c9669f6ccf89f/jackson-annotations-2.4.1.jar

  • 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。

构建失败

总时间:5.727 秒无法在设备上安装应用程序,阅读 上述错误的详细信息。确保你有一个安卓模拟器 正在运行或已连接设备并已设置您的 Android 开发 环境: https://facebook.github.io/react-native/docs/android-setup.html

最佳答案

通过将以下内容添加到 build.gradle 来修复:现在因为其他原因坏了:-)

packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}

关于java - Android 项目失败 (React Native) - 任务 ':app:packageDebug' 执行失败 APK META-INF/LICENSE 中复制的重复文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38423271/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com