Sharjeel Ali
Sharjeel Ali

Reputation: 1645

Unable to merge dex Android Studio 3.0.1

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.> com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

Just after updating Android studio 3.0.1 recently from 2.3.3 version, I am facing issue related to DexMergerException.

Someone else also posted question-related to this. But in this question, I want to analyze the stack trace to find the related solution(since I am a newbie here..).

I am unable to resolve it.

This is my build.gradle(Module:app)

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 27

    defaultConfig {
        applicationId "com.aimnatvtz.aimatv"
        manifestPlaceholders = [onesignal_app_id: "MY_ONESIGNAL_APP_ID",
                                // Project number pulled from dashboard, local value is ignored.
                                onesignal_google_project_number: "226589149887"]

        minSdkVersion 16
        targetSdkVersion 27
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    mavenCentral()
    google()
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def requested = details.requested
            if (requested.group == 'com.android.support') {
                if (!requested.name.startsWith("multidex")) {
                    details.useVersion '25.3.0'
                }
            }
        }
    }

    implementation 'com.android.support:appcompat-v7:27.0.1'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.android.support:design:27.0.1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'it.sephiroth.android.library.easing:android-easing:+'
    implementation 'com.facebook.android:facebook-login:4.27.0'
    implementation 'com.android.support:recyclerview-v7:27.0.1'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.github.bumptech.glide:glide:4.0.0'
    implementation 'com.google.android.gms:play-services-auth:11.6.2'
    implementation 'com.afollestad:sectioned-recyclerview:0.5.0'
    implementation 'com.onesignal:OneSignal:[3.6.2, 3.99.99]'
    implementation 'com.paypal.sdk:paypal-android-sdk:2.15.3'

    testImplementation 'junit:junit:4.12'
}

Upvotes: 0

Views: 1107

Answers (2)

Moonlight Kun
Moonlight Kun

Reputation: 1

I had the same problem, it is associated with the update compile 'com.google.android.gms: play-services: 11.4.2 to compile' com.google.android.gms: play-services: 11.6.0 Return back to the old version of the play-services

Upvotes: 0

Kanaiya Katarmal
Kanaiya Katarmal

Reputation: 6108

Tried to enable multidex

modify your build.gradle

dependencies {
    compile 'com.android.support:multidex:1.0.1'
}

defaultConfig {
    multiDexEnabled true
}

in your manifiest file define your apllication name properrty like this

android:name="com.pkg.YouApplication"

Include this in your Application class

public class YouApplication extends Application {

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

}

Upvotes: 1

Related Questions