2016-11-20 38 views
-1

標題說明了一切,我試圖將firebase-ads集成到我的應用程序中,這帶來了很多問題,其中一些問題我設法解決。我現在面臨的問題是這樣的錯誤:集成Firebase時出現「ZipException:重複條目」

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzqq$zza.class

僅當添加Firebase時纔會發生此錯誤。

我一直在搜索互聯網相當長一段時間,但我發現迄今爲止似乎沒有任何幫助。

模塊:應用

apply plugin: 'com.android.application' 


android { 
    compileSdkVersion 25 
    buildToolsVersion '25.0.0' 



    defaultConfig { 
     applicationId "myID" 
     minSdkVersion 16 
     targetSdkVersion 25 
     multiDexEnabled true 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.facebook.android:facebook-android-sdk:4.8.0' 
    compile 'com.android.support:appcompat-v7:25.0.1' 
    compile 'com.android.support:design:25.0.1' 
    compile 'com.amirarcane.recent-images:recentimages:1.0.0' 
    compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.4.1' 
    compile 'com.android.support:cardview-v7:25.0.1' 
    compile 'com.github.chrisbanes:PhotoView:1.3.0' 
    compile "com.daimajia.swipelayout:library:[email protected]" 
    compile "com.andkulikov:transitionseverywhere:1.7.0" 
    compile 'com.google.firebase:firebase-ads:9.2.1' 
} 

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

預先感謝您!

+0

的可能的複製[:應用程序:Android的transformClassesWithJarMergingForDebug失敗 - 拋出:ZipException:重複的條目(http://stackoverflow.com/questions/32968171/android-apptransformclasseswithjarmergingfordebug-failed-zipexception-dupli) – Shashanth

+0

火力的廣告的當前版本是9.8.0。嘗試升級到。也可以在重建之前嘗試對項目進行「清理」。 –

+0

@qbix,我已經嘗試過,同樣的事情。 – user6704969

回答

0

經過4個多小時的努力,爲重新安裝Android Studio做了幾乎所有的事情之後,我終於設法使其工作。對於你們所有人來說,遇到同樣的問題,我希望這個解決方案能夠幫助你,併爲你節省大量的時間,這令我很遺憾。

只是刪除apply plugin:'com.google.gms.google-services'

雖然這不是一個解決方案,但有解決方法,這只是爲我工作至今的東西。如果您確實選擇採取這種「解決方法」,那麼當您將來遇到另一個問題時,請不要忘記您已將其刪除。

+1

[AdMob的設置說明](https://firebase.google.com/docs/admob/android/quick-start#verify_app-level_buildgradle_excerpt)表明應用該插件的語句是build.gradle中的必需項。沒有它,你的'google-services.json'文件將不會被處理。我想你會在沒有它的情況下遇到其他問題。 –

+0

@qbix,我知道這一點,但畢竟我現在至少可以用它來工作。無論如何,問題可能會或可能不會來,而錯誤已經出現。儘管如此,我會堅持我的解決方案,直到更好的出現。 ^^ – user6704969

相關問題