user9858007
user9858007

Reputation:

Dependency Issue : DexArchiveMergerException

I have created a new Project with below dependency included :

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'

implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
implementation 'com.squareup.okhttp:okhttp:2.6.0'
implementation 'com.google.code.gson:gson:2.8.2'
}

and at the time of running the app, am getting below error :

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

What might be the issue ?

Upvotes: 2

Views: 82

Answers (1)

Siddharth Thakkar
Siddharth Thakkar

Reputation: 376

Jaimin, hope you have enabled multidex in your app gradle file using..

multiDexEnabled true

Still if it is not resolved, you add the following code:

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '26.+'
            }
        }
    }
}

Upvotes: 1

Related Questions