9

Я имею эту ошибку, когда я пытаюсь запустить свой проект:Ошибка дубликат запись: COM/Google/Android/GMS/место/место/zzj.class

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/location/places/zzj.class

Вот это build.gradle файл I Я с помощью:

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' 
} 
+0

У вас есть дублирующаяся зависимость. Кажется, у вас есть две версии google-сайтов api. – Emmanuel

+0

@ Эммануэль Это то, о чем я тоже думал. Но я просто использую одну зависимость API google places. Я не вижу, где это можно дублировать! – HiddenDroid

+1

запустить './gradlew: android: dependencies' на терминале. Одна из других библиотек, которые вы используете, вероятно, зависит от более ранней версии библиотеки google places. Вам нужно найти библиотеку, которая приводит к зависимости и исключает из нее места google. – Emmanuel

ответ

19

Я модернизировал Google Play услуги (карты, расположение и GCM) от 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' 

Затем я добавил этот депе ndency:

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

И это работает как шарм :)

+0

Спасибо большое! Вы спасли мое время :) – Ghorbanzadeh

0

я добавил последнюю версию com.google.android.gms от: https://developers.google.com/android/guides/releases и добавил force = true для модулей GMS я использую:

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; 
    } 
Смежные вопросы