Adding google services - Execution failed for task

2019-02-25 00:09发布

问题:

I'm trying to Implement GCM Client in Android Studio following the steps on this website: Implementing GCM Client on Android

As mentioned under "Set Up Google Play Services" I edited my application's build.gradle file so that it looks like that:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 20
    buildToolsVersion "23.0.0"

    defaultConfig {
        applicationId "com.buuurn.gymio"
        minSdkVersion 16
        targetSdkVersion 21
    }

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

dependencies {
    compile 'com.android.support:support-v4:23.0.0'
    compile 'com.google.android.gms:play-services:7.+'
}

If I sync gradle now I get this error message:

Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Applications/adt-bundle 23/sdk/build-tools/23.0.0/aapt'' finished with non-zero exit value 1

I've already tried to change

compile 'com.google.android.gms:play-services:7.+'

to i.e.

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

but the same error has occurred.

I've also read some posts about gradle errors while adding google services but nothing has helped yet.

Thank you!

回答1:

Have you tried to check your "buildToolsVersion"? If not, go to setting->app->properties->check your build version to see if you find it, if not use the max version you have or update it.

Regarding this error:"finished with non-zero exit value 1" there are several reason, if it caused by RAM, try restart your device, if it caused by your java environment, maybe you should reinstall.