Error: Duplicate entry when creating the apk

0

I have this error in Android Studio when I try to generate the apk

  

Error: Execution failed for task ': app: transformClassesWithJarMergingForDebug'.
  com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com / google / common / annotations / Beta.class

This is the build:gradle :

    apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
    applicationId "co.edu.unisabana.pnt.g3.proyectofinal"
    minSdkVersion 17
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

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'
})
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.code.findbugs:jsr305:2.0.1'
compile 'com.googlecode.objectify:objectify:5.0.3'
compile 'com.google.api-client:google-api-client:1.22.0'
compile 'com.google.api-client:google-api-client-android:1.19.0'
compile 'com.google.http-client:google-http-client-gson:1.19.0'
testCompile 'junit:junit:4.12'
compile project(path: ':backend', configuration: 'android-endpoints')
}

Help please, I do not know what's happening.

    
asked by carlos barriga 31.05.2017 в 06:43
source

1 answer

0

Since you have not attached the build.gradle I have attached a generic example which you should add to your build.gradle

configurations {
        all*.exclude group: 'com.android.support', module: 'support-v4'
        all*.exclude group: 'com.android.support', module: 'support-annotations'
    }

In this case you should exclude the libraries of your version that are being duplicated, that's why you get the error.

    
answered by 31.05.2017 в 09:00