1

I am building a project which is using java lamda expressions and so i recently switched to android studio 3. My project is successfully building but generating runtime exception as follows:-

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

Project level build.gradle:-

buildscript {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-rc2'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir 
}

app level build.gradle:-

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.example.project"
        minSdkVersion 24
        targetSdkVersion 26
        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'
        }
    }

    configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:multidex:1.0.2'

implementation project(":app:libs:myfolder")
testImplementation 'junit:junit:4.12'

}

Output of gradlew --stacktrace : https://ghostbin.com/paste/3kebt

I have tried clean and rebuild method, and other methods mentioned in other stackoverflow answers to similar question. But nothing works.

Edit: Already mentioned that none of the method of Dex error On Android Studio 3.0 Beta4 is working in my case and so it is not the same case and this is not the duplicate question.

Thus I need help in resolving this issue. Thanks in advance!!!

Sukhbir
  • 553
  • 8
  • 23

0 Answers0