What went wrong: Execution failed for task ':app:transformClassesWithJarMergingForDebug' - android

What went wrong:
Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
Error:Execution failed for task > ':app:transformClassesWithJarMergingForDebug'. > > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: > com/android/volley/Request$Priority.class
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.the.ex"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
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'
})
testCompile 'junit:junit:4.12'
/* compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.2.0'*/
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'org.jsoup:jsoup:1.8.3'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.android.gms:play-services:9.0.0'
compile project(':payUMoneysdk')
}
apply plugin: 'com.google.gms.google-services'

Add these inside Android{} body :
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}

Related

Android - TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzblr.class

I am trying to execute my firebase based application which is giving me following error
Update 1- I Updated multiDexEnabled to true also included packagingOptions but getting this error:
error log - Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
-> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzblr.class
My app-level build.gradle:-
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.multiplexerx.smartjournal"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
buildTypes {
release {
minifyEnabled true
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.github.chyrta:AndroidOnboarder:0.7'
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.android.gms:play-services-auth:10.2.1'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-database:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Makes sure that you're using the same library version for all of Firebase (and play services):
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.android.gms:play-services-auth:10.2.1'
compile 'com.google.firebase:firebase-database:10.2.1'

Gradle Duplicate Entry: java.util.zip.ZipException com/google/android/gms/auth/api/signin/internal/zzf.class

I am working on an android app. every time i try to run this app I get this error.
**"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.**"
I have tried all solutions in this and other forums but nothing works.
this is my build.gradle(module:app). thanks in advance.
apply plugin: 'com.android.application'
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
dexOptions {
javaMaxHeapSize "4g"
}
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "etc.solved.problem.gideon.androidalertapp"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
configurations {
all*.exclude group: 'com.android.support', module: 'play-services-tasks-10.0.1'
}}
ependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.parse:parse-android:1.10.3'
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.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.firebase:firebase-client-android:2.5.2'
compile 'com.android.support:multidex:1.0.1'
compile 'com.firebaseui:firebase-ui:1.0.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
You are using com.firebase:firebase-client-android:2.5.2 and the new SDK, com.google.firebase:firebase-database:10.0.1. You cannot use them together in the same app.
check out firebase doc

Getting an Execution failed for task ':app:transformClassesWithJarMergingForDebug'

I'm getting an exception in Android Studio while build project
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
android/support/v4/view/LayoutInflaterFactory.class
My gradle file is-
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.amt.partnerapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
dexOptions {
preDexLibraries = false
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
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:23.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'
compile 'com.android.support:design:23.4.0'
testCompile 'junit:junit:4.12'
compile files('libs/activation.jar')
compile 'com.google.android.gms:play-services:9.2.0'
compile 'com.android.support:multidex:1.0.0'
compile "com.android.support:support-v4:23.4.0"
}
com.google.android.gms:play-services:9.2.0 depends on different version of support libraries than you provided. You can check it here
Try to exclude support dependencies from it. Like that:
compile ('com.google.android.gms:play-services:9.2.0') {
exclude group: 'com.android.support', module: 'support-v4'
}

Error:Execution failed for task in android studio

when i try to add the jar files to my project i got the error like Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'. >
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
org/apache/http/annotation/Immutable.class in android studio
build.gradle
ultConfig {
applicationId "com.syzygy.extreme.uploadexample"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile files('libs/apache-httpcomponents-httpclient.jar')
compile files('libs/httpcore-4.3.3.jar')
compile files('libs/httpmime-4.0.jar')
}
Try this out for http core and mime. 100% working
android {
repositories {
mavenCentral()
}
android {
useLibrary 'org.apache.http.legacy'
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
}
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.abcd"
minSdkVersion 7
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile group: 'org.apache.httpcomponents', name: 'httpclient-android', version: '4.3.5.1'
compile('org.apache.httpcomponents:httpmime:4.3') {
exclude module: "httpclient"
}
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
testCompile 'junit:junit:4.12'
}

android studio duplicate entry: org/kxml2/io/KXmlParser.class

I use some libraries in android studio project
but there is an error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/kxml2/io/KXmlParser.class
I use mapsforge & graphhopper library and ksoap2 jar file for web services.
this is build.gradle (app) file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.mosa.palnav"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
dependencies {
// compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile('com.graphhopper:graphhopper:0.6-SNAPSHOT') {
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'org.openstreetmap.osmosis', module: 'osmosis-osm-binary'
exclude group: 'org.apache.xmlgraphics', module: 'xmlgraphics-commons'
}
compile 'org.mapsforge:mapsforge-core:0.6.0'
compile 'org.mapsforge:mapsforge-map:0.6.0'
compile 'org.mapsforge:mapsforge-map-android:0.6.0'
compile 'org.mapsforge:mapsforge-map-reader:0.6.0'
compile 'org.slf4j:slf4j-android:1.7.12'
compile 'org.slf4j:slf4j-api:1.7.12'
compile files('libs/ksoap2-android-assembly-2.6.0-jar-with-dependencies.jar')
}
how to solve this problem ?
I think you need to add a few more exclusions to your packagingOptions:
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}

Categories

Resources