android - 我在 2 天后运行我的项目,并收到一条错误消息,提示我在支持库中存在重复文件

标签 android gradle

以下是错误:

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 插件来查看我的项目的依赖关系树。我不明白如何检测重复条目(如果有)。下面是它的屏幕截图。

Project Dependency Tree

最佳答案

尝试清理您的项目:构建 ->清理

或者

在终端中执行根项目文件夹:

./gradlew clean

关于android - 我在 2 天后运行我的项目,并收到一条错误消息,提示我在支持库中存在重复文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43448858/

相关文章:

java - CustomAdapter 和 CustomTextView 的奇怪行为

android - 如何在 Android Studio 中显示依赖关系树?

gradle - 发布(rootproject)pom而没有(rootproject)发布神器/打包=pom

android - 使用 Android Studio 进行 native 开发 - 获取实验性 Gradle 2.5

android - 如何在命令行上列出 gradle 模块?

java - Graal native 图像中缺少属性文件

android - Android XML预览- “The following classes could not be found”

android - 如何在 Android 中单击的 GridView 项目上设置可绘制的背景?

Android - 在 TextView 中突出显示一个单词?

Android ExpandableListView 不展开