Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Error while merging dex archives

After updating my android studio and build tool version get this error.I have tried all the solution available for this problem over internet , but not successful don't know why this is happening ??

Android studio version: 3.1

Gradle version": 4.4

Gradle plugin : 3.1

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

My build.gradle file

apply plugin: 'com.android.application'
android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.abc.abc"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true //Tryed this but not worked
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    repositories {
        maven {
            url 'https://github.com/jitsi/jitsi-maven-repository/raw/master/releases'
        }
//    maven { url "https://dl.bintray.com/michelelacorte/maven/" }
        mavenCentral()
    }
    configurations {
        all*.exclude module: 'support-v4'
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.android.support:cardview-v7:27.1.0'
    implementation 'com.android.support:support-fragment:27.1.0'
    // multipart entity
    implementation('org.apache.httpcomponents:httpmime:4.+') {
        exclude module: "httpclient"
    }
    implementation 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
    //    implementation 'com.wonderkiln:camerakit:0.13.0'
    implementation 'com.getbase:floatingactionbutton:1.10.1'
    implementation 'org.jitsi.react:jitsi-meet-sdk:1.9.0'
    //    compile 'com.google.code.gson:gson:2.2.4'
    //    compile 'com.android.support:support-emoji:26.0.1'
    implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
    implementation 'com.android.volley:volley:1.1.0'
    implementation 'com.miguelcatalan:materialsearchview:1.4.0'
    implementation 'com.yalantis:ucrop:2.2.0-native'
    implementation 'com.pnikosis:materialish-progress:1.7'
    implementation 'org.igniterealtime.smack:smack-android-extensions:4.2.0'
    implementation 'org.igniterealtime.smack:smack-experimental:4.2.0'
    implementation 'org.igniterealtime.smack:smack-tcp:4.2.0'
    implementation 'org.apache.commons:commons-lang3:3.4'
    implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
    implementation 'com.googlecode.libphonenumber:libphonenumber:7.0.4'
    implementation 'org.greenrobot:eventbus:3.1.1'
    implementation 'com.google.android.gms:play-services-places:11.8.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.google.android.gms:play-services-maps:11.8.0'
    implementation 'com.github.bumptech.glide:glide:4.6.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
    implementation 'com.eyalbira.loadingdots:loading-dots:1.0.2'
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    // implementation 'com.google.android.exoplayer:exoplayer:2.7.1'
    //    compile 'it.michelelacorte.swipeablecard:library:2.3.0@aar'{
    //        exclude module: 'appcompat-v7'
    //        exclude group: 'com.android.support'
    //    }
    // BUTTER KNIFE
    implementation('com.jakewharton:butterknife:8.5.1') {
        exclude module: 'appcompat-v7'
        exclude group: 'com.android.support'
    }
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
    //    implementation project(':libemoji')
    implementation 'com.android.support:support-v13:27.1.0'
}

It's waste almost my 10 days... most confusing error ever encounter..

like image 463
K Guru Avatar asked Jul 10 '26 00:07

K Guru


1 Answers

This error happens if your code has two different modules of google-play-services or support-v4 which are using different versions of these libraries. Check the dependencies of the libraries you are using in your project or use

gradle app:dependencies

to see dependency tree of your project and then when you find out which libraries is used with different version, add it to your dependencies with correct version. For example if google-play-services:location:11.2.0 appeared in your dependencies, replace it with google-play-services:location:11.8.0

Usually you will see a warning or error message in your build.gradle file (i.e. one dependency will be marked with red underline showing it cause version mismatch) in such cases.

like image 100
Akram Avatar answered Jul 11 '26 16:07

Akram



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!