我已将Firebase云消息传送到我的应用程序中,但我收到以下错误。
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.>com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzqd.class
我的依赖
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile project(':module2')
}
apply plugin: 'com.google.gms.google-services'
如果你确实需要任何其他的东西告诉我,我会提供。
答案 0 :(得分:1)
Firebase可以生成DuplicateFileException,因此您还必须在应用级build.gradle中添加以下内容。以下块将添加到buildTypes块下面的android块内。
//Add the following block
packagingOptions{
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
P.S。这和米歇尔的答案相结合对我有用。
答案 1 :(得分:0)
试试这个
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile project(':module2')
}
apply plugin: 'com.google.gms.google-services'
答案 2 :(得分:0)
@Kanver Preet结帐此链接已在此处回答
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'