Skip to content Skip to sidebar Skip to footer

Execution Failed For Task ':app:transformclasseswithmultidexlistfordebug

I failed to ./gradlew assembleDebug of my appium project. Following is my app build.gradle file apply plugin: 'com.android.application' android { compileSdkVersion 26

Solution 1:

Enable multidex on build.gradlefile by changing its value to true -

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.0"

         defaultConfig {
             minSdkVersion 14//lower than 14 doesn't support multidex
             targetSdkVersion 22// Enabling multidex support.
             multiDexEnabled true
         }
}

dependencies {
    //need to add multidex dependency 
    compile 'com.android.support:multidex:1.0.1'
}

Also you need to include this in your Application class:

publicclassApplicationextendsMultiDexApplication  {

    @OverrideprotectedvoidattachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

}

Reference

Solution 2:

Try adding this library for MultiDex in dependencies part-:

compile'com.android.support:multidex:1.0.0'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile'com.android.support:multidex:1.0.0'compile'com.android.support:appcompat-v7:26.0.0-alpha1'compile'junit:junit:4.12'
    // https://mvnrepository.com/artifact/io.appium/java-client
    compile group: 'io.appium', name: 'java-client', version: '3.3.0'

}

Solution 3:

Add this line in your app level build gradle file in defaultConfig braces of your project.

defaultConfig {

        multiDexEnabled true
    }

Solution 4:

may be your app methods are over 65535,you should add compile 'com.android.support:multidex:1.0.1' in your moudle,and init mutidex in application like this: protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); }

Solution 5:

  • Update Android SDK build-tools in SDK Manager

Try build.gradle(app) file like below:-

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.example.devp1.sample"
        minSdkVersion 15
        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'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile'com.android.support:appcompat-v7:27.0.2'compile'junit:junit:4.12'compile'com.android.support:multidex:1.0.2'
    // https://mvnrepository.com/artifact/io.appium/java-client
    compile group: 'io.appium', name: 'java-client', version: '3.3.0'

}
configurations {
    all*.exclude group: 'cglib', module: 'cglib'all*.exclude group: 'commons-beanutils', module:'commons-beanutils'

}

Post a Comment for "Execution Failed For Task ':app:transformclasseswithmultidexlistfordebug"