androidandroid-studioandroid-support-libraryandroid-instant-run

Error:Execution failed for task ':app:transformClassesEnhancedWithInstantReloadDexForDebug'


My Android Studio is 2.3 Version. I am attempting to run the code but the app fails with the following errors, not sure what the problem is.

Here is the error:

Error:Execution failed for task ':app:transformClassesEnhancedWithInstantReloadDexForDebug' com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --force-jumbo --num-threads=4 --output C:\project\app\build\intermediates\reload-dex\debug C:\project\app\build\intermediates\reload-dex\debug\classes.jar}

build.gradle:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.ucmedia.project"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        apply plugin: 'com.android.application'
        multiDexEnabled true
        }
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }}
dexOptions {
    preDexLibraries false
    javaMaxHeapSize "4g"
    jumboMode true
}}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
    {exclude group: 'com.android.support', module: 'support-annotations'})
    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
    compile 'com.android.support:design:25.2.0'
    testCompile 'junit:junit:4.12'
}

I tried the following but the error still happens:


Solution

  • Adding the following code to 'build.gradle' app module solved my problem:

    dependencies {
        ...
        compile 'com.android.support:multidex:1.0.0'
        ...
    }