Daniel S.
Daniel S.

Reputation: 77

Android Studio: Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'

I am trying to build a signed Apk of my project and i get the following error:

Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/common/internal/zzv$zza$zza.class

When I choose the debug build type I got no errors and everything works fine. I searched for a while to fix this but i found nothing useful.

My build.gradle:

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

android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
    applicationId "com.danielsous.demos"
    minSdkVersion 14
    targetSdkVersion 24
    multiDexEnabled true
}
buildTypes {
    release {
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}
productFlavors {
}

}


dependencies {
compile files('libs/scanditsdk-android-4.7.5.jar')
compile 'com.android.support:support-v4:24.2.1'
compile 'com.github.attenzione:android-ColorPickerPreference:e3aa301016'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile 'com.google.code.gson:gson:2.7'
}

The other build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.1.3'
    classpath 'com.google.gms:google-services:3.0.0'
}
}

allprojects {
repositories {
    jcenter()
    maven {
        url "https://jitpack.io"
    }
}
}

Upvotes: 2

Views: 3330

Answers (2)

RelativeGames
RelativeGames

Reputation: 1593

I had 1 library and a second library made from an aar file which contained multiple resource with the same names ( pngs files with same names, strings with the same ids, layouts with the same files ). Removing the aar library fixed my issues

Upvotes: 1

mrid
mrid

Reputation: 5796

It seems that you have more than one libraries added for printHelper.

Every time that you face a duplicate entry error run ./gradlew app:dependencies and make sure that there is no duplicated versions of a same module.

Upvotes: 0

Related Questions