1

I am searching for three days now, but I don't find a answer of these Exception:

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

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

Here is my build.gradle File:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '22.0.1'
    useLibrary  'org.apache.http.legacy'

    defaultConfig {
        applicationId "de.myApp"
        minSdkVersion 21
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true


    }

    dexOptions {
        javaMaxHeapSize "4g" //specify the heap size for the dex process

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled false
        }
    }



}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.android.gms:play-services-appindexing:8.4.0'
    compile 'com.google.android.gms:play-services-auth:8.4.0'
    compile 'com.android.support:multidex:1.0.1'
    compile files('libs/achartengine-1.2.0.jar')
}

When I sync, clean and build the gradle project everythink is fine, but when I want to run the App I got this Exception... Has anyone a solution for this problem?

John Hascall
  • 9,176
  • 6
  • 48
  • 72
Marius Beu
  • 83
  • 1
  • 1
  • 7
  • Have you checked method count for libraries you have in 'libs' folder? could it be `multidex` issue? – Sergii Feb 15 '16 at 22:54
  • Have you tried my answer? – Jared Burrows Feb 20 '16 at 19:13
  • Yes, but my Problem is that i need the org.apache.http.legacy API for the connection between the app and my mySQL DB on my own Server. Do you have a solution for this connection without the Apache HTTP Api? – Marius Beu Feb 21 '16 at 19:40

2 Answers2

0

It is strange to see in your dependencies compile 'com.android.support:multidex:1.0.1' and also minifyEnabled false.

Pleae check if you exceed amount of 65K methods for your code & libraries you are using so you'll need to use multidexing, see more here. You can also follow Android docs recommendations to implement multidexing properly.

Also here are known issues with 'org.apache.http.legacy' if you are using some old gradle build tools version, see How to add Apache HTTP API (legacy) as compile-time dependency to build.grade for Android M?

Community
  • 1
  • 1
Sergii
  • 1,521
  • 3
  • 24
  • 37
0

Avoid using the following:

  • Android's internal Apache library
  • Multidex
  • Jars

Try this new config:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'

    defaultConfig {
        applicationId "de.myApp"
        minSdkVersion 21
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.android.gms:play-services-appindexing:8.4.0'
    compile 'com.google.android.gms:play-services-auth:8.4.0'
    compile files('libs/achartengine-1.2.0.jar') // I would use MP Android Chart
}
Jared Burrows
  • 54,294
  • 25
  • 151
  • 185