Duplicated entry at building Android application - java

I'm building android application and I have problem to build it. My build.gradle file contains:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.nakupniseznam"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
flatDir {
dirs 'aars'
}
}
}
dependencies {
//compile fileTree(include: ['*.jar'], dir: 'libs')
repositories {
maven {
url "http://dl.bintray.com/microsoftazuremobile/SDK"
}
}
compile files('libs/notification-hubs-0.3.jar')
compile files('libs/azure-notifications-handler-1.0.1.jar')
compile 'com.google.code.gson:gson:2.4'
compile 'com.google.guava:guava:18.0'
compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.3'
compile 'com.microsoft.azure:azure-notifications-handler:1.0.1#jar'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:support-v4:23.2.0'
}
And the build error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/microsoft/windowsazure/notifications/BuildConfig.class
Still the same error.
Try to exclude multidex, but without success and I really don't know why :(

Related

Error while trying to run my app on an emulator: >Execution failed for task ':app:transformClassesWithJarMergingForDebug

I am currently coding on a project and need some help. As in the title mentioned I get an Error when try running the app on the emulator:
Execution failed for task ':app:transformClassesWithJarMergingForDebug
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry: com/google/firebase/appindexing/Action$Builder.class
I hope someone knows a fix for this problem, thanks for upcoming suggestions.
Here's my gradle in case you need it:
>apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "app.devis.de.app"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
configurations {
all*.exclude group: 'com.android.support', module: 'support-v7'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:24.2.0'
compile 'com.google.android.gms:play-services:11.0.0'
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.0'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
}

Error: TranformException: java.util.zip.ZipException: duplicate entry:org/apache/http/HttpMessage.class error

In Android studio,for my preliminary test for my app, i build it. After gradle build success, when it is made to run, it throws an error,
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry: org/apache/http/HttpMessage.class
my app:build.gradle file is
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.nxtgn.jaunt"
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(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:25.3.1'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
compile files('libs/android-async-http-1.4.9.jar')
compile files('libs/httpclient-4.3.3.jar')
compile files('libs/apache-httpcomponents-httpcore.jar')
}
its hard for me to figure out my mistake. Please help me where I went wrong.
In terminal you need to execute in root project folder
./gradlew clean

Couldnt find solution for - Error:Execution failed for task

I have tried everything what i found while googling but still have a mistake.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzbut.class
My gradle
apply plugin: 'com.android.application'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 25
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "com.google.firebase.udacity.friendlychat"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
// Displaying images
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.firebaseui:firebase-ui-database:1.2.0'
// FirebaseUI Auth only
compile 'com.firebaseui:firebase-ui-auth:1.2.0'
// FirebaseUI Storage only
compile 'com.firebaseui:firebase-ui-storage:1.2.0'
compile 'com.google.firebase:firebase-storage:10.2.6'
// Single target that includes all FirebaseUI libraries above
compile 'com.firebaseui:firebase-ui:1.2.0'
compile 'com.android.support:multidex:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
This is because of your "multidex" dependency and "multiDexEnabled true" in debug flavor.

Android Studio Error while compiling an apk

I want to create my apk file for my project, but I get the following error:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zznf;
This is my Build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.wp.fyriaxis"
minSdkVersion 17
targetSdkVersion 25
versionCode 5
versionName "1.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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:25.0.1'
compile 'com.google.firebase:firebase-ads:10.2.0'
compile 'com.android.support:design:25.0.1'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile 'com.google.firebase:firebase-ads:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Your hint is that Multiple dex files define Lcom/google/android/gms
Meaning some of Google packages are conflicting.
The Firebase and Google play services versions must match

Facebook Audience Network Ad Sdk dependency giving run time error in Android App

While adding below dependency in build.gradle
compile 'com.facebook.android:audience-network-sdk:4.+'
The run project is giving error
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzf.class
App, build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.xyz.abc"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
pickFirst 'META-INF/maven/com.squareup.picasso/picasso/pom.properties'
pickFirst 'META-INF/maven/com.squareup.picasso/picasso/pom.xml'
}
}
repositories {
mavenCentral()
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:cardview-v7:23.0.+'
compile 'com.android.support:recyclerview-v7:23.0.+'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.google.firebase:firebase-core:9.0.2'
compile 'com.google.firebase:firebase-messaging:9.0.2'
compile 'com.facebook.android:audience-network-sdk:4.+'
compile 'com.squareup.picasso:picasso:2.5.2'
}
apply plugin: 'com.google.gms.google-services'
What can be possible solution for it?
Try this
compile('com.facebook.android:audience-network-sdk:4.13.0')
{
exclude group: 'com.google.android.gms'
}
Update Gradle and Android Studio to latest version and it starts working.

Categories