2017-09-26 37 views
0

私はFirebaseとAPI.AIでAndroidチャットボットアプリを作っています。 プロジェクトにfirebase UIのlibを追加した後、java.util.zip.ZipException:重複したエントリ実行時例外が発生しました。javaMaxHeapSize = "4g"を追加しましたが、解決策が見つかりませんでしたFirebaseUIのバージョンは動作しましたが、いずれも動作しませんでした。ZipException:重複エントリ例外

他にも同様の質問がありますが、それぞれ異なる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ファイル:1

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:[email protected]' 
    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 
} 
+0

ZIPファイルには、ファイルの場所が1回だけ含まれることがあります。いくつかのタスクの一部がエントリを2回追加します。 – Konrad

+0

[FirebaseUI docs](https://github.com/firebase/FirebaseUI-Android#dependencies)では、バージョンの互換性の要件について説明しています。 Firebaseのライブラリ10.2.1では 'firebase-ui:1.2.0'を使います。 'firebase-ui-database'の行を削除します。 FirebaseUIのすべてを 'firebase-ui:1.2.0'に含めているので、それは必要ありません。 –

答えて

0

ここ

は、メッセージです。したがって、問題を解決するには、build.gradleファイルから次のコード行を削除してください。

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

このコード行は必要ありません。そのため、あなたはduplicate entry exceptionを取得します。 FirebaseUIのバージョンの互換性を参照してください。documentationのお勧めをお勧めします。

関連する問題