gpt4 book ai didi

android - 错误:任务 ':app:transformClassesWithJarMergingForDebug'重复条目的执行失败

转载 作者:行者123 更新时间:2023-12-03 05:52:37 26 4
gpt4 key购买 nike

我通过手动添加menifest,java,res等不同文件的代码将eclipse项目转换为android studio。当我运行该项目时,它显示错误:

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

这是我的gradle文件:
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
useLibrary 'org.apache.http.legacy'

defaultConfig {

applicationId "com.example.tms032.demo_pos_rs"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}


buildTypes {
release {

minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}

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.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:multidex:1.0.1'
compile project(':CustomCalendarView')
compile files('libs/commons-discovery-0.2.jar')
compile files('libs/commons-lang-2.5.jar')
compile files('libs/gson-2.2.2.jar')
compile files('libs/javax.wsdl_1.6.2.v201005080631.jar')
compile files('libs/log4j-1.2.16.jar')
compile files('libs/picasso-2.0.0.jar')
compile files('libs/posindev.jar')
compile files('libs/printingSDK-7.5.0-javadoc.jar')
compile files('libs/sqljet.1.0.2.b885.jar')
compile files('libs/upg_bridge.jar')
testCompile 'junit:junit:4.12'

}

如何读取此错误?我尝试了许多解决方案。但它们都不起作用。

最佳答案

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

compile files('libs/commons-discovery-0.2.jar')

您还要两次编译jar文件

当相同的库具有不同的版本时,将会出现问题,

您可以按如下所示将它们从jar依赖项中排除,但这几乎行不通。
sourceSets {
main {
java {
include 'com/ourcompany/somepackage/activityadapter/**'
include 'com/ourcompany/someotherpackage/**'
exclude 'com/ourcompany/someotherpackage/polling/**'
}
}

最好的选择是找到新版本的repo而不是jar。

关于android - 错误:任务 ':app:transformClassesWithJarMergingForDebug'重复条目的执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46903432/

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