Google Play Services: Completed with zero exit value 2

I am unable to run my program due to a problem inside my gradle. I recently added a dependency:

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

      

for my project. I am using it for maps in my project. But when I run the project, I get this error:

Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72211Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42211Library UP-TO-DATE
:app:prepareComGithubShellSoftwareFab105Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable730Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
    at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502)
    at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277)
    at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491)
    at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168)
    at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)
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_25.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 48.802 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

      

I believe this is related to the compilation line above, but I need this for part of my project. I'm not really sure what to do here.

EDIT: Here's all my build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.aszend.android"
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:22.1.1'
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile files('libs/aws-android-sdk-autoscaling-2.2.1.jar')
    compile files('libs/aws-android-sdk-cloudwatch-2.2.1.jar')
    compile files('libs/aws-android-sdk-cognito-2.2.1.jar')
    compile files('libs/aws-android-sdk-core-2.2.1.jar')
    compile files('libs/aws-android-sdk-ddb-2.2.1.jar')
    compile files('libs/aws-android-sdk-ddb-mapper-2.2.1.jar')
    compile files('libs/aws-android-sdk-ec2-2.2.1.jar')
    compile files('libs/aws-android-sdk-elb-2.2.1.jar')
    compile files('libs/aws-android-sdk-kinesis-2.2.1.jar')
    compile files('libs/aws-android-sdk-lambda-2.2.1.jar')
    compile files('libs/aws-android-sdk-machinelearning-2.2.1.jar')
    compile files('libs/aws-android-sdk-mobilenalytics-2.2.1.jar')
    compile files('libs/aws-android-sdk-s3-2.2.1.jar')
    compile files('libs/aws-android-sdk-sdb-2.2.1.jar')
    compile files('libs/aws-android-sdk-ses-2.2.1.jar')
    compile files('libs/aws-android-sdk-sns-2.2.1.jar')
    compile files('libs/aws-android-sdk-sqs-2.2.1.jar')
    compile files('libs/Parse-1.9.1.jar')
    compile 'com.github.shell-software:fab:1.0.5'
    compile 'com.parse.bolts:bolts-android:1.2.0'
    compile 'com.google.android.gms:play-services:7.3.0'
}

      

All help is greatly appreciated

+3


source to share


1 answer


It looks like your project has exceeded 65536 methods, from this line in error:

com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

      

See this answer . Basically, you have a lot of imported libraries and the total number of methods in your application and all imported libraries has exceeded the limit.

Here's one thing you could try: select the individual parts of the Google Play Services you need instead of importing the entire library. See the documentation here .

So, if you only want Google Play services for Maps, replace this:



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

      

Wherein:

compile 'com.google.android.gms:play-services-maps:7.3.0'

      

And hopefully this takes you to the limit!

+10


source







All Articles