androidfirebasefirebase-authenticationfirebaseui

Don't generate apk


Help me please. Can not create apk. The application works in the emulator.

Maybe you need to do something in the gradle?

Build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.shcherbuk96.example2firebase"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    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'
    })
    compile 'com.firebaseui:firebase-ui:0.6.2'
    compile 'com.firebaseui:firebase-ui-auth:0.6.2'
    compile 'com.google.firebase:firebase-auth:10.2.0'
    compile 'com.google.firebase:firebase-database:10.2.0'
    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

Errors:

Error:java.lang.RuntimeException: com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class

Error:com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class

Error:java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class

I change: enter image description here


Solution

  • Error:java.lang.RuntimeException: com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class

    It means that you are adding the same class twice (with different versions).

    It happens because you are using FirebaseUI.
    Each version of FirebaseUI has dependency on a fixed version of firebase libraries.

    Check the table

    For convenience, here are some examples:

    FirebaseUI Version  Firebase/Play Services Version
    1.2.0               10.2.0
    1.1.1               10.0.0 or 10.0.1
    1.0.1               10.0.0 or 10.0.1
    1.0.0               9.8.0
    0.6.2               9.8.0
    0.6.1               9.6.1
    0.6.0               9.6.0
    

    Then you have to change your dependencies:

        compile 'com.firebaseui:firebase-ui:1.2.0'
        compile 'com.firebaseui:firebase-ui-auth:1.2.0'
        compile 'com.google.firebase:firebase-auth:10.2.0'
    

    Also if you are upgrading a project to version 1.x.x you may encounter the error Failed to resolve: com.twitter.sdk.android:twitter:2.x.x when syncing your project with Gradle.
    Version 1.0.0 has added a new required configuration step.

    To resolve this issue you must add the Fabric repository to your repositories:

    repositories {
        // ...
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    

    More info here.