1

Unable to merge dex

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

build.grandle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
//    buildToolsVersion "27.1.1"
    defaultConfig {
        applicationId "com.osan.user.askprediction"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 3
        versionName "1.1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation('com.payumoney.sdkui:plug-n-play:1.0.0') {
        transitive = true;
        exclude module: 'payumoney-sdk'
    }
    implementation 'com.mcxiaoke.volley:library:1.0.19'
    implementation 'com.google.android.gms:play-services-places:15.0.0'
    implementation 'com.google.firebase:firebase-messaging:15.0.0'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.payumoney.core:payumoney-sdk:7.0.1'
    testCompile 'junit:junit:4.12'
    implementation files('libs/okhttp-2.5.0.jar')
    implementation files('libs/okio-1.6.0.jar')
    implementation 'com.dinuscxj:circleprogressbar:1.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.paytm:pgplussdk:1.1.2'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
}
configurations {
    all*.exclude group: 'com.android.volley'
}
apply plugin: 'com.google.gms.google-services'
Hemant Parmar
  • 3,924
  • 7
  • 25
  • 49

2 Answers2

1

try

android {
    defaultConfig {
       multiDexEnabled true
    }
}

in your app/build.gradle

Developer
  • 333
  • 2
  • 16
1

Add this library in your dependencies too

compile 'com.android.support:multidex:1.0.1'
Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
Yashaswi N P
  • 896
  • 8
  • 15
  • @OsanKumarSingh sorry about that.. same line solved my problem. did you clean and rebuild after adding this ?? – Yashaswi N P Apr 24 '18 at 07:31
  • After clean and rebuild Information:Gradle tasks [clean, :app:assembleDebug] Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lokio/Segment; Error:com.android.dex.DexException: Multiple dex files define Lokio/Segment; Error: at – Osan Kumar Singh Apr 24 '18 at 07:33
  • can you try one last thing.. Goto build -- make project and check @OsanKumarSingh – Yashaswi N P Apr 24 '18 at 07:39