Error:Execution failed for task ':app:transformClassesWithDexForDebug'. not solving

770 Views Asked by At

I have possibly tried all the solutions regarding this issue. The full error is: Error:Execution failed for task "

':app:transformClassesWithDexForDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1

" I am posting my build.gradle scripts: Script name: RajawaliCardBoardExample-master

// Top-level build file where you can add configuration options common to all sub-projects/modules.



buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

name: Module:app >>

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'
    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
        jumboMode = true
    }

    defaultConfig {
        applicationId "com.eje_c.rajawalicardboard"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':rajawalicardboard')
    compile project(':lib_panorama_max')
    compile 'com.android.support:multidex:1.0.1'
}

name: Module:lib_panorama_max >>

apply plugin: 'java'

task nativeLibsToJar(type: Zip, description: 'create a jar archive of the native libs') {
    destinationDir file("$buildDir/native-libs")
    baseName 'native-libs'
    extension 'jar'
    from fileTree(dir: 'libs', include: '**/*.so')
    into 'lib/'
}

tasks.withType(JavaCompile) {
    compileTask -> compileTask.dependsOn(nativeLibsToJar)
        options.encoding = "UTF-8"
        options.debug = true
        options.debugOptions.debugLevel = "source,lines,vars"
        options.encoding = "UTF-8"
}


dependencies {
    compile files('libs/commons-httpclient-3.1.jar')
    compile files('libs/android.jar')
    compile fileTree(dir: 'build/native-libs', include: ['*.jar'])
}

name: Module:Rajawali >>

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'
    dexOptions {
        incremental true
        javaMaxHeapSize "2048M"
        jumboMode = true
    }
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

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

name: Module:rajawalicardboard >>

apply plugin: 'com.android.library'


android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'
    dexOptions {
        incremental true
        javaMaxHeapSize "2048M"
        jumboMode = true
    }

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

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

    compile project(':rajawali')
}

Please help to sort it out! :(

2

There are 2 best solutions below

9
IntelliJ Amiya On

At first you should add

 defaultConfig
 {

    // Enabling multidex support.
       multiDexEnabled true
 }

Open Module:app .You missing multiDexEnabled true in here .

defaultConfig {
    applicationId "com.eje_c.rajawalicardboard"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    multiDexEnabled true

}

Read Official Document about MultiDex

15
Shree Krishna On

The option 1 was adding multiDexEnabled true But you told it didn't work at all, you can try excluding group group: 'com.android.support', module: 'multidex' now which means in the compilation for example change

compile project(':rajawalicardboard')

To

compile project(':rajawalicardboard'){
        exclude group: 'com.android.support', module: 'multidex'
    }

Don't only try on this, do the same in compile project(':lib_panorama_max') if only the changes above didn't work. Try removing compile 'com.android.support:multidex:1.0.1' too.