3

Recently I update my Android Studio, and this error comes out. Any suggestions?

Thanks so much.

Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.

java.util.zip.ZipException: duplicate entry:android/support/annotation/AnimRes.class

android { compileSdkVersion 23 buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.tankexchange.android.app.tankwallet"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 21
    versionName "1.0"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':library_volley')
    compile project(':library_api')
    compile "com.android.support:support-v4:23.1.1"
    compile "com.android.support:support-v13:23.1.1"
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.android.support:gridlayout-v7:23.1.1'
    compile 'com.google.android.gms:play-services-location:8.3.0'
    compile 'com.google.android.gms:play-services-maps:8.3.0'
    compile 'com.google.android.gms:play-services-plus:8.3.0'
    compile 'com.google.android.gms:play-services-gcm:8.3.0'
    compile 'com.google.android.gms:play-services-analytics:8.3.0'
    compile 'com.google.maps.android:android-maps-utils:0.3+'

    compile 'com.makeramen:roundedimageview:2.1.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile('com.github.afollestad.material-dialogs:core:0.8.5.3@aar') {
        transitive = true
    }
    compile 'com.flipboard:bottomsheet-core:1.4.3'
    compile 'com.facebook.rebound:rebound:0.3.7'
    compile 'me.grantland:autofittextview:0.2.1'
    compile 'com.balysv:material-ripple:1.0.2'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.7.0'
    compile 'com.karumi:dexter:2.1.3'

    compile 'com.braintreepayments.api:braintree:2.+'
    compile 'com.braintreepayments:card-form:2.1.1'
    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;
    }
}

}

Jiajun
  • 71
  • 6
  • 1
    this should help http://stackoverflow.com/questions/26966843/java-util-zip-zipexception-duplicate-entry-during-packagealldebugclassesformult – muratgu Jan 29 '16 at 22:39
  • Hi muratgu, still no luck. Any more suggestions? – Jiajun Jan 29 '16 at 23:47
  • did you find the offending library? what have you tried from that link? – muratgu Jan 30 '16 at 00:36
  • It means that you are adding twice the same class (may be with different version). Check your dependencies and post your build.gradle and your dependencies. – Gabriele Mariotti Jan 30 '16 at 07:18
  • Hi all, I post my gradle dependencies. Please please help me find the duplicate 'android/support/annotation'. Thanks so much. – Jiajun Jan 30 '16 at 07:52

2 Answers2

1

Finally, I found the reason.

compile ('com.karumi:dexter:2.1.3'){
            exclude module: 'support-annotations'
        }

This is the lib has duplicate import!

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Jiajun
  • 71
  • 6
0

In your App Gradle file enable the multiDexEnabled

android {

    defaultConfig {
            ...
        multiDexEnabled true
    }


dependencies {
            ...
    compile 'com.android.support:multidex:1.0.1'

}
Pavan Bilagi
  • 1,618
  • 1
  • 18
  • 23