I made:
Error is:
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Project build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.asanquran.mnaum.quranasaanurdutarjuma"
minSdkVersion 15
targetSdkVersion 26
versionCode 3
versionName "1.3"
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:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-ads:11.4.2'
compile 'com.github.barteksc:android-pdf-viewer:2.3.0'
compile 'org.apache.commons:commons-io:1.3.2'
compile 'com.google.firebase:firebase-ads:11.4.2'
compile 'com.google.firebase:firebase-messaging:11.4.2'
compile 'com.google.firebase:firebase-storage:11.4.2'
apply plugin: 'com.google.gms.google-services'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
<project>/app/
and open build.gradle
filedefaultConfig
and dependencies
sectionsandroid {
...
defaultConfig {
...
multiDexEnabled true // ADD THIS LINE
}
}
...
dependencies {
...
implementation 'com.android.support:multidex:1.0.3' // ADD THIS LINE
}
I know it's too late to update.I had same issue on my project.
Possible Reasons
Solutions
Check your dependencies tree using below command and see if any mismatch in dependencies.
./gradlew :app:dependencies
You can exclude particular module from any dependencies like below.
implementation('com.google.android.ads.consent:consent-library:1.0.4') {
transitive = true
exclude group: "com.android.support"
}
In above example, It will exclude the com.android.support group from consent-library dependencies.
You can also remove particular module as well.
compile ('junit:junit:4.12'){
exclude group: 'org.hamcrest', module:'hamcrest-core'
}
In above example it will exclude hamcrest-core from org.hamcrest.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With