I got this error when i have tried to rebuild my project:
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Despite i have added this line
multiDexEnabled true
in my app module gradle file, the error become as below.
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write [C:\Users\Amine\AndroidStudioProjects\Movies\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\Users\Amine\AndroidStudioProjects\Movies\app\build\intermediates\transforms\desugar\debug\19.jar(;;;;;;**.class)] (Duplicate zip entry [19.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]))
Also I have cleaned after rebuilded the project, but I have the same issue.
Below , the gradle of my app module:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.0'
defaultConfig {
applicationId "com.aoutir.mohamed.movies"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildTypes.each {
it.buildConfigField("String", "MOVIES_END_POINT", "\"https://api.themoviedb.org\"")
it.buildConfigField("String", "APPIKEY", "\my API Key")
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
}
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:recyclerview-v7:27.0.0'
compile 'com.android.support:cardview-v7:27.0.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:okhttp:3.0.1'
compile 'io.reactivex.rxjava2:rxjava:2.0.1'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
compile 'com.android.support:appcompat-v7:27.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:27.+'
compile 'com.android.support:design:27.0.1'
testCompile 'junit:junit:4.12'
}
Below the gradle file of my project module:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Thanks in advance for any help.