繁体   English   中英

具有Appcompact库的Android Studio中的Gradle构建错误

[英]Gradle build error in android studio with appcompact library

我收到此错误

Error:Execution failed for task ':yourapp:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/v7/recyclerview/BuildConfig.class

这是我的build.gradle文件

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.test"
        minSdkVersion 15
        multiDexEnabled true
        targetSdkVersion 22
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile (project(':library_slidingmenu')) {
    exclude group: 'com.android.support', module: 'recyclerview-v7'
}
    compile project(':library')
    compile 'com.android.support:appcompat-v7:22.2.1'
    androidTestCompile 'com.android.support:multidex-instrumentation:1.0.1'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.squareup.okhttp:okhttp:2.5.0'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0'
    compile 'org.projectlombok:lombok:1.16.6'
    compile 'com.google.android.gms:play-services:8.1.0'
    compile 'com.android.support:cardview-v7:22.1.0'
    compile 'com.android.support:recyclerview-v7:22.1.0'

知道如何解决吗?

如果您的依赖项也声明了recyclerview lib,则将其从依赖项中排除。 例如,假设您的lib library_slidingmenu包含recyclerview依赖项,那么我们将需要执行以下操作

dependencies {
    compile project(':library_slidingmenu') {
        exclude group: 'com.android.support', module: 'recyclerview-v7'
    }
    // the rest of your dependecies
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM