com.android.dex.DexException: Multiple dex files define LSevenZip/CRC - android

my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.varuniyer.contetto"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
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:22.2.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile files('/Users/varuniyer/AndroidStudioProjects/Contetto/xwalk_core_library/libs/xwalk_core_library.jar')
compile files('/Users/varuniyer/AndroidStudioProjects/Contetto/xwalk_shared_library/libs/xwalk_shared_library.jar')
}
I'm trying to create a Crosswalk Android example application.
I keep getting this error:
* What went wrong:
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 LSevenZip/CRC;
I've looked at other questions but none of their solutions have worked. I'm kinda stuck what to do now.
Thanks in advance.

Try just pulling in just the core library i.e. removing the following line from the build:
compile files('/Users/varuniyer/AndroidStudioProjects/Contetto/xwalk_shared_library/libs/xwalk_shared_library.jar')
Worth checking out this link too:
https://crosswalk-project.org/documentation/shared_mode.html

Related

Android Studio APK build error - Multiple dex files define Landroid/support/v4/

//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 Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat;
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.1"
defaultConfig {
applicationId "com.cpsraozan.admission"
minSdkVersion 15
targetSdkVersion 27
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:27.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile 'com.google.firebase:firebase-core:9.4.0'
}
apply plugin: 'com.google.gms.google-services'
Go to your build.gradle file and add multidexEnable true on defaultConfig.
android {
compileSdkVersion 26
defaultConfig {
targetSdkVersion ..
multiDexEnabled true //add this
}
}
For more information See this
This is kind of NOT straight forward. Most likely you might have added a new dependency or updated a dependency which is causing multiple versions of the same library being added as a dependency.
Check if Android studio is highlighting any lines for this, especially in Gradle files.
Run a dump of all dependencies Gradle is processing using the command
./gradlew -q dependencies app:dependencies
check for conflicting dependencies and fix them.
I was struggling this morning with the same error and the requirement for multiDexEnabled didn't make sense. This is only for large projects with more than 64k methods. I found this solution somewhere on SO, but couldn't find it again. So reposting the answer.

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. while running the application [duplicate]

This question already has answers here:
compile 'com.firebaseui:firebase-ui:0.4.3 how to fix error. i get every time error with any firebase ui dependencies
(2 answers)
Closed 5 years ago.
I am using firebase for using facebook and google login in my application and getting below error when I run my code. I tried everything on stackoverflow to resolve this. Like adding packagingoptions, including multidexEnabled to true,deleting the libs folder and whatever I could get. But these didn't work for me.
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
here is the build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.ranjit.firebaseauthentication"
minSdkVersion 18
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'
})
compile 'com.firebaseui:firebase-ui-auth:0.4.4'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.google.firebase:firebase-auth:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
I don't know why, But simply restarting the Android studio worked for me without any change in the above code.

Google maps android app build error :app:transformClassesWithDexForDebug

I am currently developing a custom themed version of google maps, and have spent the past god knows how long trying to resolve this build error. I have researched this extensively, and found nothing which seems to help solve my problem.
I have included my app/build.gradle file below
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.wtwelectronics.googlemapsrev2"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
}
}
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.google.android.gms:play-services:10.2.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
}
The 1st error line of the gradle console output is below:
Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process
I am using android studio 2.3.1, with latest SDK packages etc.
Thanks in advance.
try adding this in your gradle
compile 'com.google.android.gms:play-services-maps:10.2.0'
and look at this example for more.

apache Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.api

When i build and run the project on my nexus 5 device, it works well. But then, when I build and run the project on my Samsung GT-I9100(api 16), it shows error of :
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 Lorg/apache/http/Consts;
then I add the multiDexEnabled true to my gradle. When i try to compile again, now I get following error message
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 Lorg/apache/http/Consts;
but again, it is working fine when I compile it on my Nexus 5(api 23)
My app gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.project.example"
minSdkVersion 16
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'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
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:multidex:1.0.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.android.support:design:25.1.1'
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-database:10.2.0'
compile 'com.android.support:appcompat-v7:25.2.0'
testCompile 'junit:junit:4.12'
}
You have to add dependency in your gradle as well
compile 'com.android.support:multidex:1.0.1'
only adding multiDexEnabled true won't work since your minSkdVersion is lower then 21. see documentation here Conifigure you apps for multidex
Also you have to extend MultiDexApllication in your application class instead of Application
Try adding following code in build level gradle(build.gradle)
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}

java.util.zip.ZipException: duplicate entry: com/facebook/ads/AbstractAdListener.class

I am trying to implement facebook mobile ads in an android app. Everything went fine but in build gradle i m getting error.
Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry:
com/facebook/ads/AbstractAdListener.class.
And build.gradle codes are
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.mohit.warmodroid.practicefbads"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
multiDexEnabled true
}
}
}
dependencies
{
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile ('junit:junit:4.12'){
exclude group: 'com.facebook.ads', module: 'classes.jar'
}
compile 'com.android.support:appcompat-v7:23.0.1'
compile ('com.android.support:design:23.0.1'){
exclude group: 'com.facebook.ads', module: 'classes.jar'
}
compile('com.facebook.android:audience-network-sdk:4.7.0'){
exclude group: 'com.facebook.ads', module: 'classes.jar'
}
compile 'com.android.support:multidex:1.0.0'
}
I tried everything availble on stackoverflow.com but unable to clear it.
Please help me out.
In the Gradle settings and project configurations there is an old version of AudienceNetwork.jar, existing in the \libs folder. Remove this jar file from \libs and rebuild the project: this should fix the problem.

Categories

Resources