-1

My application gradle file looks like this.

 dependencies {
             compile fileTree(dir: 'libs', include: ['*.jar'])
             testCompile 'junit:junit:4.12'
             compile project(':purpleb2b')
             compile 'com.android.support:appcompat-v7:23.1.1'
             compile 'com.android.support:design:23.1.1'
             compile 'com.android.support:support-v4:23.1.1'
             compile 'com.jakewharton:butterknife:7.0.1'
             compile 'com.android.support:cardview-v7:23.1.1'
             compile 'com.squareup.picasso:picasso:2.5.2'
             compile 'com.thomashaertel:multispinner:0.1.1'
             compile 'com.itextpdf.tool:xmlworker:5.5.8'
             compile 'com.google.android.gms:play-services:8.4.0' }

When I added the last library (Play services) it gave me the below error.

Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

The purpleb2b is a custom library for the project and its dependencies are as follows

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'de.greenrobot:greendao:2.0.0'
    compile 'com.google.code.gson:gson:2.4'
    compile 'me.neavo:volley:2014.12.09'
    compile 'org.apache.httpcomponents:httpmime:4.3.1'
    compile 'org.apache.httpcomponents:httpcore:4.3.1'
    compile 'itext:itext:1.3.1'
    compile 'org.json:json:20151123'
    compile 'com.opencsv:opencsv:3.6'
    compile 'org.apache.httpcomponents:httpclient:4.5'
}

If I remove play services everything works fine. Could you please help me resolving this issue...

Minto
  • 2,004
  • 1
  • 15
  • 19

2 Answers2

1

It's because play services causes 65536 methods error. Try to use particular services that you need. Full overview of libraries you can find there

Viktor Dolgalyov
  • 274
  • 2
  • 12
0

Simple in your gradle file add these ...

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {

    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"

    // Enabling multidex support.
    multiDexEnabled true

}

 // add dexOptions
dexOptions {
    incremental true
    javaMaxHeapSize "4g"
}
// Add 
packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
}


dependencies {
provided fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.parse:parse-android:1.11.0'
 // add multidex dependency 
compile 'com.android.support:multidex:1.0.1'

}

reference: Error:Execution failed for task ':app:dexDebug' error in my project while I added new dependency

Community
  • 1
  • 1
Anvesh523
  • 368
  • 6
  • 18