Android Studio Gradle“文件google-services.json缺少模块根目录。如果没有它,Google Services插件就无法运行。”

时间:2016-02-20 12:51:40

标签: java android android-studio gradle

我一直收到这个错误:

  

错误:任务':app:processDebugGoogleServices'的执行失败   >模块根文件夹中缺少文件google-services.json。没有它,Google服务插件就无法运行。

buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
    jcenter()
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
    classpath 'com.android.tools.build:gradle:2.0.0-beta5'
    classpath 'com.google.gms:google-services:2.0.0-beta5'

}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}


android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.example.computing.lincolnopenday"
    minSdkVersion 21
    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')
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile('com.twitter.sdk.android:twitter:1.12.1@aar') {
    transitive = true;
}


}
apply plugin: 'com.google.gms.google-services'

1 个答案:

答案 0 :(得分:-1)

您无法使用

  

classpath' com.android.tools.build:gradle:2.0.0-beta5'

因为最新的

  

classpath' com.android.tools.build:gradle:1.5.0'

https://developer.android.com/tools/revisions/gradle-plugin.html

此外,here建议添加

  

compile' com.google.gms:google-services:2.0.0-beta5'

用gradle建造。