0

This is my build.gradle

when I build project give this error:

Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. java.io.IOException: Can't write [D:\Dev\android\fruit\Fruit\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\Users\bahrani.gradle\caches\transforms-1\files-1.1\support-core-ui-27.1.1.aar\7c83800d6960afec35a787899d518156\jars\classes.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]))

When I Run project give this error:

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

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.2"
    defaultConfig {
        applicationId "pinuit.app.ir.fruit"
        minSdkVersion 17
        targetSdkVersion 27
        multiDexEnabled true
        versionCode 3
        versionName "1.7"
        manifestPlaceholders = [onesignal_app_id               : "222c377a-7695-433c-b6a0-4edd3cd79771",
                                // Project number pulled from dashboard, local value is ignored.
                                onesignal_google_project_number: "REMOTE"]
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    repositories {
        mavenCentral()
    }
}

dependencies {
    compile ('com.android.support.constraint:constraint-layout:1.0.2'){
        exclude group: 'com.android.support', module:'support-v4'
    }
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile ('com.android.support:support-v4:27.0.2') {
        exclude group: 'com.android.support', module:'support-v4'
    }
    compile ('com.android.support:appcompat-v7:27.0.2') {
        exclude group: 'com.android.support', module:'support-v4'
    }
    compile ('com.android.support:cardview-v7:27.0.2') {
        exclude group: 'com.android.support', module:'support-v4'
    }
    compile ('com.android.support:recyclerview-v7:27.0.2') {
        exclude group: 'com.android.support', module:'support-v4'
    }
    compile ('com.android.support:design:27.0.2') {
        exclude group: 'com.android.support', module:'support-v4'
    }
    implementation 'it.sephiroth.android.library.bottomnavigation:bottom-navigation:2.0.1-rc1'
    implementation 'com.wang.avi:library:2.1.3'
    implementation('com.squareup.retrofit2:retrofit:2.1.0') {
        exclude module: 'okhttp'
    }
    implementation 'com.squareup.okhttp3:okhttp:3.4.1'
    implementation 'com.squareup.retrofit2:converter-gson:+'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.3.1'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'jp.wasabeef:glide-transformations:2.0.0'
    implementation 'com.onesignal:OneSignal:[3.8.3, 3.99.99]'
    implementation 'com.google.firebase:firebase-core:12.0.1'
    implementation 'com.nineoldandroids:library:2.4.0'
    implementation 'com.daimajia.slider:library:1.1.5@aar'
}


apply plugin: 'com.google.gms.google-services'

1 Answers1

0

I saw this similar error when trying to import a Unity3D project into Android Studio. First, I changed 'compile' to 'implementation' see the link below

https://stackoverflow.com/a/47304057/8634987

In my case I was trying to import multiple .aar files, and the solution I found to this error was to import all of the .aar files as libraries individually. Hopefully this will help a bit

Kunal Shah
  • 610
  • 6
  • 17