0

I am getting following

build fail message:
Error:FAILURE: Build failed with an exception.

What went wrong:

Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list.

Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 13s

Here is my build.gradle file code:

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "com.bhashaproject.bhashas"
        minSdkVersion 20
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'

    compile 'com.android.support:appcompat-v7:27.1.1'
    compile 'com.android.support:support-v4:27.1.1'
    compile 'com.android.support:design:27.1.1'
    compile 'com.android.support:cardview-v7:27.1.1'
    compile 'com.android.support:support-vector-drawable:27.1.1'
    compile 'com.android.support:customtabs:27.1.1'
    compile 'org.apache.httpcomponents:httpcore:4.4.4'
    compile 'com.squareup.okhttp3:okhttp:3.9.0'
    compile 'com.android.support:design:27.1.1'
    compile 'com.android.support:support-v4:27.1.1'
    compile 'com.google.code.gson:gson:2.8.0'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'com.koushikdutta.ion:ion:2.1.7'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
    compile 'com.android.support:recyclerview-v7:27.1.1'
    compile 'com.android.support:multidex:1.0.3'
    compile files('libs/httpmime-4.1.jar')
    compile files('libs/sinch-android-rtc-3.8.0-VIDEO-SNAPSHOT.jar')
    compile 'com.payumoney.sdkui:plug-n-play:1.4.1'
}
}

Please help.

ʍѳђઽ૯ท
  • 16,646
  • 7
  • 53
  • 108
Ajinkya
  • 3
  • 3
  • Welcome to Stack Overflow. Would you please also add the `build.gradle` codes too? – ʍѳђઽ૯ท Sep 10 '18 at 06:36
  • Thank you @ʍѳђઽ૯ท. I have updated question. – Ajinkya Sep 10 '18 at 07:03
  • Possible duplicate of [Getting Error: Execution failed for task app:transformClassesWithMultidexlistForDebug](https://stackoverflow.com/questions/37906750/getting-error-execution-failed-for-task-apptransformclasseswithmultidexlistfor) – ʍѳђઽ૯ท Sep 10 '18 at 07:17

1 Answers1

1

You have duplicate dependencies in your Build.gradle.

Try removing these:

compile 'com.android.support:design:27.1.1'
compile 'com.android.support:support-v4:27.1.1'

No need for adding another dependenices in this case (multidex). This will increase the project size and etc. Honestly, I wouldn't do that since it can be done by removing those duplicate dependencies.


Note that compile is replaced with implementation on new Android Studio version and you better to check: What's the difference between implementation and compile in Gradle?

ʍѳђઽ૯ท
  • 16,646
  • 7
  • 53
  • 108