【发布时间】:2017-10-24 06:17:38
【问题描述】:
我通过手动添加不同文件(如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'
}
如何读取此错误?我尝试了很多解决方案。但它们都不起作用。
【问题讨论】:
-
您的两个外部库共享同一个名为“IntegerRes.class”的类,因此如果不使用,请尝试删除任何一个库。
-
请找到并告诉我哪些是共享同一类的两个库。我可以为您提供其他选择。
-
我检查了每个文件依赖库的类,没有一个包含这个类。
标签: android gradle duplicates dependencies