1

I have some problem with my project. In Android Studio 3.0, it works fine, but when I updated to 3.0.1, I have problem to merge dex.

I clean and rebuild project. I use multiDexEnabled true with dependency

What is wrong:

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

app level gradle:

apply plugin: 'com.android.application' 
android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.rotaractnepalapp.rotraconversation"
        minSdkVersion 15
        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'
        }
    }
}  
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.firebase:firebase-auth:11.0.4'
    implementation 'com.android.support:support-v4:27.1.0'
    implementation 'com.google.firebase:firebase-database:11.0.4'
    implementation 'com.google.firebase:firebase-storage:11.0.4'
    implementation 'com.google.firebase:firebase-messaging:11.0.4'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    implementation 'com.android.support:cardview-v7:27.1.0'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.squareup.okhttp:okhttp:2.5.0'
    implementation 'com.firebaseui:firebase-ui-database:2.3.0'
    implementation 'id.zelory:compressor:2.1.0'
    compile 'com.android.support:support-annotations:27.1.0'
}  
apply plugin: 'com.google.gms.google-services'
Pang
  • 9,564
  • 146
  • 81
  • 122

2 Answers2

0

Add below dependency in gradle file

com.google.android.gms:play-services:11.4.0

Clean and Rebuild the application it will work.

balu
  • 444
  • 1
  • 3
  • 10
0

I'm running into the same issue. I tried enabling multidex through the instructions here, but the error persisted. I also disabled instant run, as was suggested in another post, but that made no impact. I ended up having to revert all support libraries from version 27.1.0 back to version 27.0.2. Once I did, the error was corrected with no need for any multidex configuration. There is maybe an issue with 27.1.0.

CORRECTION: I found an unused library ('android.arch.paging:runtime:1.0.0-alpha4-1') and removed it, then updated the versions back to 27.1.0 with no issue. Since your minSdkVersion is 15, be sure to follow the step 2 under the Configure your app for multidex section to ensure your application is extending the multidexapplication class.