Domenico Picerno
Domenico Picerno

Reputation: 65

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. >

When I execute my app I get this error:

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

com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_60\bin\java.exe'' finished with non-zero exit value 1

It happened suddenly and I don't know why Here is the code of my gradle setting of the module that doesn't works:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "it.uniba.di.sms.studente.adem.bikesharing"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.google.android.gms:play-services-location:8.3.0'
    compile 'com.google.android.gms:play-services:9.4.0'
}

and this is the code of the gradle setting of the full app

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

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

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

EDIT: Error I get after enabling multidexing:

AGPBI: {"kind":"error","text":"UNEXPECTED TOP-LEVEL ERROR:","sources":[{}]} AGPBI: {"kind":"error","text":"java.lang.OutOfMemoryError: GC overhead limit exceeded","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.rop.type.Type.internClassName(Type.java:415)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:289)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.cf.cst.ConstantPoolParser.parse(ConstantPoolParser.java:150)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.cf.cst.ConstantPoolParser.parseIfNecessary(ConstantPoolParser.java:124)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.cf.cst.ConstantPoolParser.getPool(ConstantPoolParser.java:115)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:482)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.command.dexer.Main.parseClass(Main.java:764)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.command.dexer.Main.access$1500(Main.java:85)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1684)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.command.dexer.Main.processClass(Main.java:749)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.command.dexer.Main.processFileBytes(Main.java:718)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.command.dexer.Main.access$1200(Main.java:85)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1645)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.command.dexer.Main.processOne(Main.java:672)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.command.dexer.Main.processAllFiles(Main.java:569)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.command.dexer.Main.runMultiDex(Main.java:366)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.command.dexer.Main.run(Main.java:275)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.command.dexer.Main.main(Main.java:245)","sources":[{}]} AGPBI: {"kind":"error","text":"\tat com.android.dx.command.Main.main(Main.java:106)","sources":[{}]}

:app:transformClassesWithDexForDebug FAILED

FAILURE: Build failed with an exception.

Upvotes: 1

Views: 940

Answers (2)

Prasad De Zoysa
Prasad De Zoysa

Reputation: 2567

You are importing Google Play services "location" service twice. com.google.android.gms:play-services:9.4.0 line itself contains location services. Therefore its redundant and cause above error.

You probably wanna remove this line,

compile 'com.google.android.gms:play-services:9.4.0'

And keep this,

compile 'com.google.android.gms:play-services-location:8.3.0'

Google has listed all the sub services which comes with Google Play Services. And you should not import com.google.android.gms:play-services:9.4.0 complete library unless otherwise you uses all the services. This link has complete sub list of Google Play services, so you can import only the necessary ones.

Upvotes: 0

Yogesh Rathi
Yogesh Rathi

Reputation: 6499

Just remove this line, and rebuild

compile 'com.google.android.gms:play-services-location:8.3.0'

If until issue is not resolved then integrate multi dex lib, you can see How to enable multidexing with the new Android Multidex support library

Upvotes: 1

Related Questions