java - ZipException:重复输入异常

标签 java android firebase gradle firebaseui

我正在使用Firebase和API.AI开发Android聊天机器人应用程序。
将firebase UI库添加到项目后,我得到了 java.util.zip.ZipException:重复条目运行时异常。此后,我添加了javaMaxHeapSize =“4g”,但找不到解决方案。尝试使用其他FirebaseUI版本,但没有一个起作用。

还有其他类似的问题,但每个问题都是通用的,具有不同的build.grade。

这是消息:

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

Gradle文件:
apply plugin: 'com.android.application'

android {
  compileSdkVersion 25
  buildToolsVersion "25.0.2"
  defaultConfig {
    applicationId "com.bot.chatbot.chatbot"
    minSdkVersion 16
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled = true
  }
  dexOptions {
    javaMaxHeapSize = "4g"
  }
  buildTypes {
    release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

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

  //Google
  compile 'com.android.support:appcompat-v7:25.3.1'
  compile 'com.android.support:recyclerview-v7:25.3.1'
  compile 'com.android.support:design:25.3.1'
  compile 'com.android.support.constraint:constraint-layout:1.0.2'

  //AI
  compile 'ai.api:sdk:2.0.7@aar'
  compile 'ai.api:libai:1.4.8'
  compile 'com.google.code.gson:gson:2.3.1'
  compile 'commons-io:commons-io:2.4'

  //Firebase
  compile 'com.google.firebase:firebase-core:10.2.1'
  compile 'com.google.firebase:firebase-storage:10.2.1'
  compile 'com.google.firebase:firebase-auth:10.2.1'
  compile 'com.google.firebase:firebase-database:10.2.1'
  compile 'com.firebaseui:firebase-ui:0.4.3'
  compile 'com.firebaseui:firebase-ui-database:2.3.0'


  testCompile 'junit:junit:4.12'
}


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

第二个 :
 buildscript {
      repositories {
        jcenter()
      }
      dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.1.0'

      }
    }

    allprojects {
      repositories {
        jcenter()
      }
    }

task clean(type: Delete) {
  delete rootProject.buildDir
}

最佳答案

发生这种情况是因为您将旧的依赖项与新的依赖项混合在一起。因此,为了解决您的问题,请从build.gradle文件中删除以下代码行。

compile 'com.firebaseui:firebase-ui-database:2.3.0'

不需要这一行代码,这就是为什么要获得duplicate entry exception的原因。请参阅FirebaseUI的版本兼容性,建议您查看官方的documentation

关于java - ZipException:重复输入异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46434875/

相关文章:

java - 在 Java 中查找连续的数字

java - 根据值调整 JScrollPane 中 JList 的大小

android - 为 Android 应用程序选择 flash/openGL/其他动画?

java - 使用Netty构建一个只有很少客户端的服务器

android - 没有这样的文件或目录,但实际上路径似乎是正确的

android - 这个 LinearLayout 应该使用 android :layout_height ="wrap_content"?

javascript - 如何使用 Javascript 和 Firebase 从数据库中删除 child_object

ios - Tableview 搜索栏未正确返回 detailTextLabel(Xcode - Swift)

带有 Firebase 和 Google App 引擎的 Java 服务器

java - 在不反序列化的情况下从 JSON 字符串中的任何位置删除键