0

I unable to build the gradle and getting error.I'm using android studio 3.0 stable version

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

Detail:

Information:Gradle tasks [clean, :app:assembleDebug]
Error:Execution failed for task   
':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write [D:\Studio Projects\SampleMVP 
\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't   read [D:\Studio Projects\SampleMVP\app\build\intermediates\transforms\desugar\debug\13.jar(;;;;;;**.class)] (Duplicate zip entry [13.jar:android/support/v4/view/ViewPager$1.class]))
Information:BUILD FAILED in 4m 6s
Information:1 error
Information:0 warnings
Information:See complete output in console

My app gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion "27.0.0"
defaultConfig {
    applicationId "ocs.com.samplemvp"
    minSdkVersion 15
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}
dataBinding {
    enabled = true
}


compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
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'
}

I tried to many time clean and rebuild but not working

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Rajasekaran M
  • 2,478
  • 2
  • 20
  • 30

2 Answers2

0

1. Rebuild your project

2. Clean your project then rebuild it.

3. Delete /build directory in /project directory and delete /build directory from /project/app/ directory , then remake the project.

4. If you already installed the application uninstall it.

Abdur Rahman
  • 894
  • 1
  • 11
  • 27
0

1. Rebuild your project if you can't from android studio menu Invalidate caches/ restrat...

2. Clean your project then rebuild it.

3. Delete /build directory in /project directory and delete /build directory from /project/app/ directory , then remake the project.

5. From android studio menu Invalidate caches/ restrat... 4. If you already installed the application uninstall it.

Unable to merge dex can help you

Nawrez
  • 3,314
  • 8
  • 28
  • 42