Android - 重复条目:com / google / android / gms / internal / zzafz.class错误 [英] Android - duplicate entry: com/google/android/gms/internal/zzafz.class Error

查看:298
本文介绍了Android - 重复条目:com / google / android / gms / internal / zzafz.class错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 错误:执行任务失败':app:transformClassesWithJarMergingForDebug' > 
com.android.build.api.transform.TransformException:
java.util.zip.ZipException:重复项:
com / google / android / gms / internal / zzafz.class

我不知道这是什么意思,我可以修复它。我需要你的帮助
我已经处理了几件事情,但没有什么帮助,我添加了 multiDexEnabled true ,并导致该错误。



在那个错误之前,O有 android错误以非零退出值2 完成。在添加 multiDexEnabled true 之后,它给了我这个错误:

duplicate如何解决这个问题,任何帮助,将不胜感激:http://www.microsoft.com/technet/security/bulletin/ !

这是我的清单

  apply plugin:'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion23.0.3

defaultConfig {
applicationIdcom.world.bolandian.gpstracker
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName1.0
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}

packagingOptions {
不包括'META-INF / LICENSE'
不包括'META-INF / LICENSE-FIREBASE。 txt'
'META-INF / NOTICE'
}
}

依赖关系{
编译fileTree(dir:'libs',include:[ '* .jar'])
testCompile'junit:junit:4.12'
compile'c​​om.android.support:appcompat-v7:23.3.0'
compile'c​​om.google.android .gms:play-services-maps:9.6.1'
compile'c​​om.google.firebase:firebase-database:9.2.1'
compile'c​​om.firebase:firebase-client-android:2.3 .1'
compile'c​​om.google.firebase:firebase-auth:9.2.1'
}
apply plugin:'com.google.gms.google-services'


解决方案

您既包含旧版Firebase API,也包含

  compile'c​​om.firebase:firebase-client-android:2.3.1'

和新的Firebase API:

  compile'c​​om.google.firebase :firebase-database:9.2.1'
compile'c​​om.google.firebase:firebase-auth:9.2.1'

不应该一起使用。删除 firebase-client-android:2.3.1 并按照 Firebase升级指南



使用相同版本的Firebase和Play服务库也很重要。请勿使用Firebase库的9.6.1 play-services-maps 和9.2.1。最新版本是10.0.1。考虑更新所有的依赖关系以使用最新版本。



更新:

我复制了你发布的依赖,并能够重现错误。在用这些替换了依赖关系之后,错误就解决了。这些工作不适合你吗?

$ p code $ dependency {
compile fileTree(dir:'libs',include:[' * .jar'])
testCompile'junit:junit:4.12'
compile'c​​om.android.support:appcompat-v7:23.3.0'
compile'c​​om.google.android。 gms:play-services-maps:10.0.1'
compile'c​​om.google.firebase:firebase-database:10.0.1'
compile'c​​om.google.firebase:firebase-auth:10.0。 1'
}


I got this error when I run the code ->

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

I have no idea what does it means and do I fix it. I need your help guys I have treid several things but nothing really helped, I added "multiDexEnabled true" and that cause to that error.

Before that error O had "android error finished with non-zero exit value 2". After I added "multiDexEnabled true", it gives me this error:

"duplicate entry: com/google/android/gms/internal/zzafz.class Error"

How can I fix it, any help would be appreciated!

this is my Manifest

    apply plugin: 'com.android.application'

  android {
       compileSdkVersion 23
       buildToolsVersion "23.0.3"

defaultConfig {
    applicationId "com.world.bolandian.gpstracker"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

packagingOptions {
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE-FIREBASE.txt'
    exclude 'META-INF/NOTICE'
  }
}

dependencies {
   compile fileTree(dir: 'libs', include: ['*.jar'])
   testCompile 'junit:junit:4.12'
   compile 'com.android.support:appcompat-v7:23.3.0'
   compile 'com.google.android.gms:play-services-maps:9.6.1'
   compile 'com.google.firebase:firebase-database:9.2.1'
   compile 'com.firebase:firebase-client-android:2.3.1'
   compile 'com.google.firebase:firebase-auth:9.2.1'
  }
   apply plugin: 'com.google.gms.google-services'

解决方案

You are including both the legacy Firebase API:

compile 'com.firebase:firebase-client-android:2.3.1'

and the new Firebase APIs:

compile 'com.google.firebase:firebase-database:9.2.1'
compile 'com.google.firebase:firebase-auth:9.2.1'

They should not be used together. Remove firebase-client-android:2.3.1 and follow the instructions in the Firebase Upgrade guide.

It is also important to use the same versions of Firebase and Play Services libraries. Don't use 9.6.1 of play-services-maps and 9.2.1 of the Firebase libs. The latest versions available are 10.0.1. Consider updating all of your dependencies to use the latest versions.

Update:

I copied the dependencies you posted and was able to reproduce the error. After I replaced the dependencies with these, the error was resolved. Do these not work for you?

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.google.android.gms:play-services-maps:10.0.1'
    compile 'com.google.firebase:firebase-database:10.0.1'
    compile 'com.google.firebase:firebase-auth:10.0.1'
}

这篇关于Android - 重复条目:com / google / android / gms / internal / zzafz.class错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆