Android Error Regarding MultiDex - java

I'm getting the following error when I build my application in Android:
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: oauth/signpost/http/HttpResponse.class
My build.gradle looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.me.hey"
minSdkVersion 8
targetSdkVersion 22
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')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.semantics3:Sem3Java:1.2.2'
compile files('libs/Sem3Java-1.2.2-jar-with-dependencies.jar')
compile 'com.android.support:multidex:1.0.0'
}
Any ideas on what I might be doing wrong?

Related

How to resolve Unable to merge dex

When I was compile my application so I got below error like,
Error:Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Unable to merge
dex
I add the multiDexEnabled true in my app.build file but still getting same issue. how can I resolve this error.
Here below my app.build file
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.rutunjay.retrofit_example"
minSdkVersion 21
targetSdkVersion 27
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'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}}
dependencies {
testImplementation 'junit:junit:4.12'
compile 'android.arch.lifecycle:runtime:1.0.0-alpha1'
compile 'android.arch.lifecycle:extensions:1.0.0-alpha1'
annotationProcessor "android.arch.lifecycle:compiler:1.0.0-alpha1"}
Use latest Dependencies for Lifecycle, including LiveData and ViewModel.
Try this
implementation 'android.arch.lifecycle:runtime:1.1.1'
implementation 'android.arch.lifecycle:extensions:1.1.1'
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
than Clean-Rebuild- Run your project

Why android studio 3, show me this error?

somebody can tell me, why Android Studio 3.0.1, show me this error when make app?
Execution failed for task ':joy-android-game-gdx:transformDexArchiveWithExternalLibsDexMergerForDebugAndroidTest'.
> java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
The next attach *my build gradle**
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.websmithing.gpstracker"
minSdkVersion 15
targetSdkVersion 25
versionCode 15
versionName "4.0.5"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.loopj.android:android-async-http:1.4.9'
}
the app compila when i delete this line:
compile 'com.android.support:appcompat-v7:25.0.0'
but the app after moment automatic close
Try
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.websmithing.gpstracker"
minSdkVersion 15
targetSdkVersion 25
versionCode 15
versionName "4.0.5"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.android.support:multidex:1.0.2'
}
Beside this, please review your dependency versions. They are not the latest versions and you might want to update them. Take care of the buildToolsVersion as well.

java.util.zip.ZipException: duplicate entry: com/google/android/gms/auth/api/signin/internal/zzk.class

this is the error and I canĀ“t find the duplicate entry.
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/zzk.class
This is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.john.mapafinal"
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(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.google.firebase:firebase-auth:9.0.2'
compile 'com.android.support:design:22.2.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
}
Help please!

Android studio plain java library proguard

Is it possible to have different build types for plain java libraries in Android Studio with gradle? My intention is to run proguard and minify the jar file size.
Java build.gradle
apply plugin: 'java'
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
}
Android build.gradle
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "test.app"
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
}
productFlavors {
buildWithSingleAlarmFlavour {
applicationId "test.app"
versionName ".1"
}
buildWithMultipleAlarmFlavour {
applicationId "test.app"
versionName "0.1"
}
}
}

Android Studio GRADLE BUILD VERY SLOW

When I run my project in android studio , it takes long to compile,
it usually requires 3 - 5 minutes.
In Gradle Console it stopping long time in: :app:dexDebug
How can I reduce the time ???
my bulild.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "it.unical.mat.myapp"
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 'com.android.support:multidex:1.0.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile files('libs/activation.jar')
compile files('libs/gdata-analytics-2.1.jar')
compile files('libs/gdata-core-1.0.jar')
compile files('libs/gdata-spreadsheet-3.0.jar')
compile files('libs/jsr305.jar')
compile files('libs/mail.jar')
compile files('libs/guava-18.0.jar')
}

Categories

Resources