web-dev-qa-db-fra.com

Erreur de duplication: com/google/Android/gms/location/places/zzj.class

Je rencontre cette erreur lorsque j'essaie d'exécuter mon projet:

Erreur: L'exécution a échoué pour la tâche ': app: transformClassesWithJarMergingForDebug' . com.Android.build.api.transform.TransformException: Java.util.Zip.ZipException: entrée en double: com/google/Android/gms/emplacement/places/zzj.class

Voici le fichier build.gradle que j'utilise:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.Android.tools.build:gradle:2.1.2'
        classpath 'io.realm:realm-gradle-plugin:0.89.1'
    }
}
apply plugin: "com.Android.library"
apply plugin: "realm-Android"

repositories {
    jcenter()
}

Android {
    compileSdkVersion 23
    buildToolsVersion '23.0.3'

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 22
    }

    buildTypes {
        debug {
            minifyEnabled false
        }
        release {
            minifyEnabled false
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile "com.Android.support:appcompat-v7:23.1.1"
    compile "com.Android.support:cardview-v7:23.1.1"
    compile "com.Android.support:recyclerview-v7:23.1.1"
    compile "com.Android.support:design:23.1.1"
    compile "com.squareup.okhttp3:okhttp:3.1.2"
    compile ('com.facebook.Android:facebook-Android-sdk:4.9.0')
        { exclude group: 'com.Android.support' }
    compile ('com.googlecode.libphonenumber:libphonenumber:7.2.2')
        { exclude group: 'com.Android.support' }
    compile "com.pubnub:pubnub-Android:3.7.6"
    compile "com.google.Android.gms:play-services-maps:9.0.0"
    compile "com.google.Android.gms:play-services-gcm:9.0.0"
    compile "com.google.Android.gms:play-services-location:9.0.0"
    compile ('com.appyvet:materialrangebar:1.3')
        { exclude group: 'com.Android.support' }
    compile 'com.google.code.gson:gson:2.5'
    compile "com.amazonaws:aws-Android-sdk-s3:2.2.10"
    compile "com.amazonaws:aws-Android-sdk-core:2.2.10"
    compile ('com.instabug.library:instabug:2.1')
        { exclude group: 'com.Android.support' }
    compile 'com.github.tony19:logback-Android-core:1.1.1-4'
    compile 'com.github.tony19:logback-Android-classic:1.1.1-4'
    compile 'org.slf4j:slf4j-api:1.7.6'
    compile 'ch.acra:acra:4.8.2'
    compile 'pl.droidsonroids.gif:Android-gif-drawable:1.1.15'
    compile 'org.greenrobot:eventbus:3.0.0'
    compile 'com.Android.support:multidex:1.0.0'
}
11
HiddenDroid

J'ai mis à niveau les services Google Play (cartes, emplacement et gcm) de la version 9.0.0 à 9.2.0.

compile 'com.google.Android.gms:play-services-location:9.2.0'
compile 'com.google.Android.gms:play-services-maps:9.2.0'
compile 'com.google.Android.gms:play-services-gcm:9.2.0'

Ensuite, j'ai ajouté cette dépendance:

compile 'com.google.Android.gms:play-services-places:9.2.0'

Et ça marche comme un charme :)

20
HiddenDroid

J'ai ajouté la dernière version de com.google.Android.gms à partir de: https://developers.google.com/Android/guides/releases Et ajouté force = true pour les modules gms I utilisation:

    compile('com.google.Android.gms:play-services-analytics:11.0.2') {
        force = true;
    }
    compile('com.google.Android.gms:play-services-ads:11.0.2') {
        force = true;
    }
    compile('com.google.Android.gms:play-services-gcm:11.0.2') {
        force = true;
    }
0
Florin Dobre