0

As I mentioned the app runs pretty fine on the emulator but I cant build apk, the problem should be in this build.gradle file , I rearranged it after I had some other error but I didn't quite hit the mark

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"
    defaultConfig {
        applicationId "com.example.apak.flancer"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/notice.txt'
    }
    configurations { all*.exclude group: 'com.android.support', module: 'support-v4'
        all*.exclude group: 'com.android.support', module: 'support-annotations' }

    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.android.support:appcompat-v7:25.3.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.1'
    compile 'com.google.firebase:firebase-auth:10.2.0'
    compile 'com.google.firebase:firebase-database:10.2.0'
    compile 'com.google.firebase:firebase-storage:10.2.0'
    compile 'com.google.firebase:firebase-messaging:10.2.0'
    compile 'com.android.support:design:25.3.0'
    compile 'com.android.support:support-v4:25.3.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.firebaseui:firebase-ui:0.6.0'

    compile 'com.android.support:recyclerview-v7:25.3.0'
    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

this is the updated build.grandle(app level):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.apak.flancer"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"

        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.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.firebase:firebase-auth:10.2.0'
    compile 'com.google.firebase:firebase-database:10.2.0'
    compile 'com.google.firebase:firebase-storage:10.2.0'
    compile 'com.google.firebase:firebase-messaging:10.2.0'
    compile 'com.google.android.gms:play-services-auth:10.2.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.firebaseui:firebase-ui:1.0.1'

    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

The Error I get is:

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
Apak
  • 137
  • 11
  • Open a terminal and execute in your project folder: `./gradlew clean` – Teocci May 10 '17 at 01:45
  • also you can try this: `android{ configurations { all*.exclude group: 'com.android.support', module: 'support-v4' all*.exclude group: 'com.android.support', module: 'support-annotations' } }` – Teocci May 10 '17 at 01:50
  • I tried both before posting this but didnt work – Apak May 10 '17 at 01:58
  • Adding this:android{ configurations { all*.exclude group: 'com.android.support', module: 'support-v4' all*.exclude group: 'com.android.support', module: 'support-annotations' } } gave errors for my imports in the java classes – Apak May 10 '17 at 02:00
  • Usually when you use `compile 'com.android.support:support-v4:25.3.0'` and ` compile 'com.android.support:appcompat-v7:25.3.0'` you have this problem. Can you add the problem that you have after adding the configurtion group to the android module? – Teocci May 10 '17 at 02:04
  • after added configuration group I cant run the app on emulator Error:(14, 30) error: cannot find symbol class FragmentManager and Error:(7, 30) error: cannot find symbol class Fragment – Apak May 10 '17 at 02:08
  • should I change compile 'com.android.support:support-v4:25.3.0' directly into compile 'com.android.support:support-v7:25.3.0' and install Respitory – Apak May 10 '17 at 02:13
  • could you please update your `build.gradle` file? – Teocci May 10 '17 at 02:32
  • do u mean update this post's build.grandle ? – Apak May 10 '17 at 02:44
  • yupe I want to see where did you put the configuration module... – Teocci May 10 '17 at 02:46
  • Updated, btw thanks for your concern – Apak May 10 '17 at 02:50
  • [Try this build.gradle](https://pastebin.com/6GxnHJrS) and Update to the `25.3.1` also the problem is this line `compile 'com.android.support.constraint:constraint-layout:1.0.1'` do you need that library? if you need it update it to the version `1.0.2` – Teocci May 10 '17 at 02:54
  • Possible duplicate of [java.util.zip.ZipException: duplicate entry during packageAllDebugClassesForMultiDex](http://stackoverflow.com/questions/26966843/java-util-zip-zipexception-duplicate-entry-during-packagealldebugclassesformult) – degs May 10 '17 at 04:01
  • 1
    Possible duplicate of [duplicate entry: com/google/android/gms/auth/api/signin/internal/zzf.class](http://stackoverflow.com/questions/41021286/duplicate-entry-com-google-android-gms-auth-api-signin-internal-zzf-class) – Sufian May 10 '17 at 06:38
  • He mentioned that he tried with those previous post That is why I didn't fagged as a duplicated – Teocci May 10 '17 at 10:01
  • solved this problem I dont know exact solution but I posted my updated build.grandle(app) Other then that I added this: repositories { jcenter() mavenLocal() mavenCentral() maven { url 'https://maven.fabric.io/public' } } } to build.grandle(Project level) – Apak May 10 '17 at 20:00
  • Probably this `com.android.support.constraint:constraint-layout:1.0.1` component was causing the problem. – Teocci May 11 '17 at 00:02

0 Answers0