gpt4 book ai didi

java - APK 错误中的重复文件

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

我正在尝试在我的 android 项目中使用 Watson java 包装器。当我刚刚添加

compile 'com.ibm.watson.developer_cloud:java-wrapper:0.1.4'

对于我的 gradle,我在 META-INF/LICENSE 错误中发现重复文件。有谁知道如何解决这个问题?

我的build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
applicationId "com.cool.myapp"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.ibm.watson.developer_cloud:java-wrapper:0.1.4'
}

Messages Gradle 显示这个

Error:duplicate files during packaging of APK /Users/Shaik/Downloads/AskAshiq/app/build/outputs/apk/app-debug-unaligned.apk
Path in archive: META-INF/DEPENDENCIES
Origin 1: /Users/Shaik/.gradle/caches/modules-2/files-2.1/org.apache.james/apache-mime4j/0.6/945007627e8d12275d755081a9e609c018e1210d/apache-mime4j-0.6.jar
Origin 2: /Users/Shaik/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.0.1/e813b8722c387b22e1adccf7914729db09bcb4a9/httpcore-4.0.1.jar
You can ignore those files in your build.gradle:
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
}
}
Error:Execution failed for task ':app:packageDebug'.
> Duplicate files copied in APK META-INF/DEPENDENCIES
File 1: /Users/Shaik/.gradle/caches/modules-2/files-2.1/org.apache.james/apache-mime4j/0.6/945007627e8d12275d755081a9e609c018e1210d/apache-mime4j-0.6.jar
File 2: /Users/Shaik/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.0.1/e813b8722c387b22e1adccf7914729db09bcb4a9/httpcore-4.0.1.jar

添加这个也没有帮助

  packagingOptions {
exclude 'META-INF/LICENSE'
}

最佳答案

尝试通过添加来排除所有文件。

packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}

关于java - APK 错误中的重复文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30750838/

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