2017-07-25 170 views
0

嘗試運行項目時出現錯誤錯誤:任務':app:transformClassesWithJarMergingForDebug'的執行失敗。

錯誤:執行任務':app:transformClassesWithJarMergingForDebug'失敗。

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/common/internal/zzc.class

的build.gradle文件:

android { 
    compileSdkVersion rootProject.ext.compileSdkVersion 
    buildToolsVersion rootProject.ext.buildToolsVersion 
    packagingOptions 
    { 
    exclude 'META-INF/DEPENDENCIES' 
    exclude 'META-INF/NOTICE' 
    exclude 'META-INF/LICENSE' 
    exclude 'META-INF/LICENSE.txt' 
    exclude 'META-INF/NOTICE.txt' 
    } 

aaptOptions { 
    cruncherEnabled = false 
} 

dexOptions { 
    preDexLibraries = false 
    incremental true 
    javaMaxHeapSize "4g" 
} 
} 

dependencies { 
     compile fileTree(dir: 'libs', include: ['*.jar']) 
     compile project(':bottom-bar') 
     compile project(':cropper') 
}androidTestCompile('com.android.support.test.espresso:espressocore:2.2.2', 
    { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 

     testCompile "junit:junit:${rootProject.ext.junitVersion}" 

// Multidex 
    compile 'com.android.support:multidex:1.0.1' 

    compile "com.android.support:appcompat- v7:${rootProject.ext.supportLibraryVersion}" 
    compile "com.android.support:design:${rootProject.ext.supportLibraryVersion}" 

// RecyclerView 
    compile "com.android.support:recyclerview-v7:${rootProject.ext.supportLibraryVersion}" 
// CardView 
    compile "com.android.support:cardview- v7:${rootProject.ext.supportLibraryVersion}" 

    compile 'com.google.android.gms:play-services:9.0.0' 

// Firebase 
    compile 'com.google.firebase:firebase-messaging:11.0.2' 
    compile 'com.google.firebase:firebase-core:11.0.2' 
    compile 'com.google.firebase:firebase-database:11.0.2' 

// Butterknife 
    compile 'com.jakewharton:butterknife:8.4.0' 
    apt 'com.jakewharton:butterknife-compiler:8.4.0' 

// Design Compatibility for all resolution 
    compile 'com.intuit.sdp:sdp-android:1.0.3' 

// Retrofit API cals 
    compile 'com.google.code.gson:gson:2.6.2' 
    compile 'com.squareup.retrofit2:retrofit:2.0.2' 
    compile 'com.squareup.retrofit2:converter-gson:2.0.2' 
    compile 'com.squareup.okhttp3:logging-interceptor:3.3.0' 

// Picaso Image loading 
    compile 'com.squareup.picasso:picasso:2.5.0' 

// Realm db inplace of SQlite 
    compile 'io.realm:realm-android:0.82.1'} 

讓我知道,如果它是需要一些其他的信息。 謝謝。

+0

更新此編譯「com.google.android.gms:發揮服務:11.0.2」 –

+0

我曾嘗試這一點,但它降落在另一個錯誤 –

+0

檢查我答... –

回答

0

試試這個

packagingOptions 
{ 
    exclude 'META-INF/DEPENDENCIES' 
    exclude 'META-INF/NOTICE' 
    exclude 'META-INF/LICENSE' 
    exclude 'META-INF/LICENSE.txt' 
    exclude 'META-INF/NOTICE.txt' 
    pickFirst 'META-INF/license.txt' 
} 
+0

我嘗試過但不工作 –

0
Remove this line 

compile 'com.google.android.gms:play-services:9.0.0' add plugin after dependency block 

like this 
dependencies { 
//your dependencies here 
}apply plugin: 'com.google.gms.google-services' 

and add this line in application build.gradle **classpath 'com.google.gms:google-services:3.0.0'** 

Ex: 
buildscript { 
repositories { 
    jcenter() 
} 
dependencies { 
    classpath 'com.android.tools.build:gradle:1.5.0' 
    classpath 'com.google.gms:google-services:3.0.0' 

    // NOTE: Do not place your application dependencies here; they belong 
    // in the individual module build.gradle files 
} 
} 
相關問題