evgenus196
evgenus196

Reputation: 163

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

Upvotes: 1

Views: 125

Answers (4)

sam wong
sam wong

Reputation: 11

Android Studio: The version released in Spring 2023 is 2023.1.1.

Gradle: The version released in Spring 2023 is 8.1.1.

Java: The version released in Spring 2023 is Java 17. some apk ok

Upvotes: 0

sam wong
sam wong

Reputation: 11

Android Studio: The latest stable version is 2023.2.1 (released in February 2024).

Gradle: The latest version is 8.11.1 (released in November 2024).

Java: The latest version is Java 23 (released in September 2024).

down grade them as above, you can make the apk

Upvotes: 1

Javanshir
Javanshir

Reputation: 792

Problem is inside the gradle file, not manifest.

All firebase and support libraries should be of the same version. Check it and set them to the save version.

You should update your firebase dependencies:

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

Also add the following, if you haven't done it already:

allprojects {
   repositories {
       maven { url 'https://maven.fabric.io/public' }
   }
}

(more here)

P.S: try to not use example in your package name

Upvotes: 0

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363975

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.

Upvotes: 2

Related Questions