0

I'm able to clean and rebuild the project files but I couldn't run the application as it throws one RuntimeException.

this is my error :

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

this is my gradle :

/*
 * Copyright © 2018 Quillbook. All rights reserved
 */

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.dumpcoders.danielcruise.quillbook"
        minSdkVersion 17
        multiDexEnabled true
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }

}
packagingOptions {
    exclude 'AndroidManifest.xml'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'

}
dexOptions {

    jumboMode true
    javaMaxHeapSize "4g"

}
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:design:27.0.2'
    implementation 'com.android.support:support-v4:27.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'
    implementation('com.amazonaws:aws-android-sdk-mobile-client:2.6.15@aar') { transitive = true }
    implementation 'com.amazonaws:aws-android-sdk-cognito:2.6.15'
    implementation 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.6.15'
    implementation 'com.amazonaws:aws-android-sdk-core:2.6.15'
    implementation 'com.amazonaws:aws-android-sdk-ddb:2.6.15'
    implementation 'com.amazonaws:aws-android-sdk-mobileanalytics:2.6.15'
    implementation 'com.amazonaws:aws-android-sdk-s3:2.6.15'
    implementation 'com.amazonaws:aws-android-sdk-sns:2.6.15'
    implementation 'com.amazonaws:aws-android-sdk-sqs:2.6.15'
    api 'com.amazonaws:aws-android-sdk-apigateway-core:2.6.15'
}

I've implemented all the AWS libs which is required for my project, what i'm trying to do here is connect to AWS!

1 Answers1

1

UPDATE: Tried your gradle config and worked flawlessly. but main reason of problem lies in

dexOptions {
    jumboMode true
    javaMaxHeapSize "4g"
}

more about the jumboMode

tatocaster
  • 316
  • 3
  • 10
  • Not worked for me... in the event log it says : Sources not found: Sources for 'aws-android-sdk-apigateway-core-2.6.15.jar' not found – gameatronist Feb 25 '18 at 11:50
  • Messages Gradle Build : Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. > java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex – gameatronist Feb 25 '18 at 12:06
  • I did everything I could @tatocaster – gameatronist Feb 25 '18 at 12:33
  • I tried the same gradle config, even without the multidex and works without a problem. Try to invalidate Android Studio cache and try again. I tried with/without `jumboMode` but the same effect, build is successful. – tatocaster Feb 25 '18 at 16:22
  • I invalidated and restarted android studio and again it's the same.... are you now saying to remove the jumbo mode in multidex? – gameatronist Feb 25 '18 at 16:43
  • in both cases, your gradle config worked for me. Try to remove `dexOptions` object and clean/rebuild from the scratch. It seems there is not only 1 correct way to solve this problem – tatocaster Feb 25 '18 at 18:16
  • 1
    Yeah !! ..... Thanks a ton Man it worked ... I've been looking for the solution since 8 hours. You saved my day! @tatocaster – gameatronist Feb 25 '18 at 18:46
  • Good to know. I will edit answer please accept it or upvote at least. good luck – tatocaster Feb 25 '18 at 19:25