以下是错误:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/hardware/display/DisplayManagerJellybeanMr1.class
以下是我的模块级build.gradle文件:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.aishwarya.easyreimbursement"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
resValue "string", "app_name", "Easy Reimbursement"
}
debug {
applicationIdSuffix ".debug"
resValue "string", "app_name", "Easy Reimbursement (debug)"
}
}
}
/* Use 23 on 32- bit OS, as 24 onwards support for 32- bit OS has been dropped */
project.ext.supportLib = "23.2.1"
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:$supportLib"
compile "com.android.support:design:$supportLib"
compile "com.android.support:recyclerview-v7:$supportLib"
compile "com.android.support:cardview-v7:$supportLib"
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton:butterknife:8.5.1'
apt 'com.jakewharton:butterknife-compiler:8.5.1'
compile 'com.android.support:multidex:1.0.1'
}
在我的研究之后,我了解到这是由于重复的依赖文件造成的。我可以在我的项目依赖树中检查它。我尝试从命令行执行此操作但没有输出:
aishwaryat@Linux-1:~/EasyReimbursement$ gradlew app:dependencies
No command 'gradlew' found, did you mean:
Command 'gradle' from package 'gradle' (universe)
gradlew: command not found
aishwaryat@Linux-1:~/EasyReimbursement$ gradle app:dependencies
The program 'gradle' is currently not installed. You can install it by typing:
sudo apt-get install gradle
aishwaryat@Linux-1:~/EasyReimbursement$
我安装了Gradle-View插件来查看项目的依赖关系树。我不知道如何检测重复的条目,如果有的话。下面是它的屏幕截图。
答案 0 :(得分:1)
尝试清理项目:构建 - >清洁
或
在终端执行根项目文件夹中:
./gradlew clean