gpt4 book ai didi

Android gradle 构建给出了 DuplicateFileException

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

您好,在添加 apache poi gradle build 之后,我得到了这个期望。能否请您解释一下如何解决它。

我试过用很多方法排除包选项,都没有用

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'org.greenrobot:greendao:3.2.0'
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.9'

}

错误:任务 ':app:transformResourcesWithMergeJavaResForDebug' 执行失败。

com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE File1: /home/surendra/.gradle/caches/modules-2/files-2.1/org.apache.poi/poi-ooxml-schemas/3.9/4c514498f0e82cccfdd3208b9caff2f45158db4a/poi-ooxml-schemas-3.9.jar File2: /home/surendra/.gradle/caches/modules-2/files-2.1/org.apache.poi/poi-ooxml/3.9/bbe83c739d22eecfacd06d7e0b99ba13277040ed/poi-ooxml-3.9.jar File3: /home/surendra/.gradle/caches/modules-2/files-2.1/org.apache.poi/poi/3.9/5d5e41354e88322e4bc590b31f3d2d1d52b3e6ac/poi-3.9.jar

最佳答案

尝试使用以下代码排除重复的文件

packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
pickFirst 'META-INF/license.txt'
}

关于Android gradle 构建给出了 DuplicateFileException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45143336/

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