gpt4 book ai didi

java - 任务 :app:transformClassesWithJarMergingForDebug 执行失败

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:52:27 26 4
gpt4 key购买 nike

我目前正在开发一个 Android 应用程序,但每当我尝试加载某些 jar 文件时,我都会收到以下错误:

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/annotation/WorkerThread.class

这是我的gradle文件

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
applicationId "company.example.com.mobileapp"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile files('libs/apache-httpcomponents-httpclient.jar')
compile files('libs/apache-httpcomponents-httpcore.jar')
//compile files('libs/java-json.jar')
//compile files('libs/android-support-v4.jar')
compile files('libs/commons-codec-1.10.jar')
compile files('libs/commons-io-2.4.jar')
compile files('libs/commons-lang3-3.4.jar')
}

最佳答案

你正在添加这一行

compile fileTree(dir: 'libs', include: ['*.jar'])

所以去掉多余的线

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
}

Remove this line

compile fileTree(dir: 'libs', include: ['*.jar'])

dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile files('libs/apache-httpcomponents-httpclient.jar')
compile files('libs/apache-httpcomponents-httpcore.jar')
//compile files('libs/java-json.jar')
//compile files('libs/android-support-v4.jar')
compile files('libs/commons-codec-1.10.jar')
compile files('libs/commons-io-2.4.jar')
compile files('libs/commons-lang3-3.4.jar')
}

关于java - 任务 :app:transformClassesWithJarMergingForDebug 执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38091366/

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