在build.gradle中添加库时获取异常

时间:2016-12-23 11:59:43

标签: android build.gradle

这是我的build.gradle。在添加谷歌分析依赖时,我会得到如下的异常 TransformException:java.util.zip.ZipException:重复条目:android / support / multidex / BuildConfig.class

 apply plugin: 'com.android.application'

    android {
        compileSdkVersion 22
        buildToolsVersion '21.0.1'
        defaultConfig {
            applicationId "***.***.***"
            minSdkVersion 17
            targetSdkVersion 22
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        productFlavors {
        }
    }

    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        compile 'com.google.code.gson:gson:2.2.+'
        compile 'com.squareup.picasso:picasso:2.5.2'
        compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.5.0'
        compile files('libs/retrofit.jar')
        compile files('libs/parceler-api.jar')
        compile files('libs/android-binding-v30-0.5.jar')
        compile 'info.hoang8f:android-segmented:1.0.6'
        compile 'com.squareup.retrofit2:retrofit:2.0.2'
        compile 'com.squareup.okhttp3:okhttp:3.2.0'
        compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0'
        compile 'io.reactivex:rxandroid:1.0.1'
        compile 'com.squareup.retrofit2:converter-gson:2.0.2'
        compile files('libs/YouTubeAndroidPlayerApi.jar')
        compile files('libs/acra-4.6.1.jar')
        compile 'com.android.support:multidex:1.0.0'
        compile files('libs/achartengine-1.1.0.jar')
        compile 'com.android.support:appcompat-v7:22.0.0'
        compile 'com.android.support:appcompat-v7:22.2.0'
        compile 'me.relex:circleindicator:1.2.1@aar'
        compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
        compile 'com.google.android.gms:play-services-analytics:8.1.0'
        compile 'com.google.android.gms:play-services:8.1.0'
        compile 'com.google.android.gms:play-services-ads:8.1.0'

1 个答案:

答案 0 :(得分:1)

删除此compile 'com.android.support:appcompat-v7:22.0.0'

这也是重复compile com.google.android.gms:play-services-gcm:9.6.1' 并使用{{1}}进行GCM