2017-04-18 125 views
-3

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzbtk.class錯誤:執行失敗的任務:應用程序:transformClassesWithJarMergingForDebug

當我運行我們的Android Studio項目這些錯誤上來。我怎麼解決它們?

我gradle這個文件:

apply plugin: 'com.android.application' 


android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.2" 
    defaultConfig { 
     applicationId "com.example.shikshamela.shikshamela" 
     minSdkVersion 15 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
     multiDexEnabled true 

    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    dexOptions { 
     preDexLibraries = false 
    } 
} 

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


    }) 


    compile 'com.android.support:multidex:1.0.1' 
    compile 'com.android.support:appcompat-v7:25.3.1' 
    compile 'com.android.support:design:25.3.1' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    compile 'com.google.android.gms:play-services-auth:10.2.1' 
    compile 'com.google.firebase:firebase-messaging:10.2.1' 
    compile 'com.google.firebase:firebase-core:10.0.1' 
    compile 'com.google.firebase:firebase-auth:10.0.1' 
    compile 'com.android.support:support-v4:25.3.1' 
    testCompile 'junit:junit:4.12' 
} 

apply plugin: 'com.google.gms.google-services' 
+0

太舊問題.show你'build.gradle' –

+0

刪除您'編譯「com.google.firebase:火力的消息:10.2.1''線,並嘗試在/ libs目錄下編譯 –

回答

0

應用插件: 'com.android.application'

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.2" 
    defaultConfig { 
     applicationId "com.example.shikshamela.shikshamela" 
     minSdkVersion 15 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
     multiDexEnabled true 

    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    dexOptions { 
     preDexLibraries = false 
    } 
} 

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


    }) 




     compile 'com.android.support:multidex:1.0.1' 
     compile 'com.android.support:appcompat-v7:25.3.1' 
     compile 'com.android.support:design:25.3.1' 
     compile 'com.android.support.constraint:constraint-layout:1.0.2' 
     compile 'com.google.android.gms:play-services-auth:10.2.1' 
     compile 'com.google.firebase:firebase-messaging:10.2.1' 
     compile 'com.google.firebase:firebase-core:10.0.1' 
    compile 'com.google.firebase:firebase-auth:10.0.1' 
    compile 'com.android.support:support-v4:25.3.1'    
    testCompile 'junit:junit:4.12' 

} 
apply plugin: 'com.google.gms.google-services' 
+0

是否有一些.jar文件,如support-v4? –

+0

使用'10.2.1'而不是'10.0.1'。 –

+0

刪除這篇文章,並將此問題添加到 –

0
// copy paste below code 

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


     }) 


     compile 'com.android.support:multidex:1.0.1' 
     compile 'com.android.support:appcompat-v7:25.3.1' 
     compile 'com.android.support:design:25.3.1' 
     compile 'com.android.support.constraint:constraint-layout:1.0.1' 
     compile 'com.google.android.gms:play-services-auth:10.2.1' 
     compile 'com.google.firebase:firebase-messaging:10.2.1' 
     compile 'com.google.firebase:firebase-core:10.2.1' 
     compile 'com.google.firebase:firebase-auth:10.2.1' 
     compile 'com.android.support:support-v4:25.3.1' 
     testCompile 'junit:junit:4.12' 
    } 
+0

更改這些錯誤時顯示 –

+0

錯誤:配置項目':app'時發生問題。 >無法解析配置的所有依賴關係 >無法找到com.android.support.constraint:constraint-layout:25.3.1。 >找不到com.google.android.gms:play-services-auth:25.3.1。 >無法找到com.google.firebase:firebase-messaging:25.3.1。 需求人: 項目:app >無法找到com.google.firebase:firebase-core:25.3.1。 >無法找到com.google.firebase:firebase-auth:25.3.1。 必需: 項目:應用程序 –

+0

嗨,我已經更新了我的答案,請檢查。 – vinod

0

嘗試這種變化

compile 'com.android.support:multidex:1.0.1' 
compile 'com.android.support:appcompat-v7:25.3.1' 
compile 'com.android.support:design:25.3.1' 
compile 'com.android.support.constraint:constraint-layout:25.3.1' 
compile 'com.google.android.gms:play-services-auth:25.3.1' 
compile 'com.google.firebase:firebase-messaging:25.3.1' 
compile 'com.google.firebase:firebase-core:25.3.1' 
compile 'com.google.firebase:firebase-auth:25.3.1' 
compile 'com.android.support:support-v4:25.3.1' 
testCompile 'junit:junit:4.12' 

compile 'com.android.support:multidex:1.0.1' 
compile 'com.android.support:appcompat-v7:25.3.1' 
compile 'com.android.support:design:25.3.1' 
compile 'com.android.support.constraint:constraint-layout:25.3.1' 
compile 'com.google.android.gms:play-services-auth:25.3.1' 
compile 'com.google.firebase:firebase-messaging:10.2.1' 
compile 'com.google.firebase:firebase-core:10.2.1' 
compile 'com.google.firebase:firebase-auth:10.2.1' 
compile 'com.android.support:support-v4:25.3.1' 
testCompile 'junit:junit:4.12' 
0

使依賴jars兼容,所以更新這兩個最新版本。

compile 'com.google.firebase:firebase-core:10.0.1' 
compile 'com.google.firebase:firebase-auth:10.0.1' 

更新到

compile 'com.google.firebase:firebase-core:10.2.1' 
compile 'com.google.firebase:firebase-auth:10.2.1' 
相關問題