错误:
任务":app:processDebugGoogleServices"的执行失败。请 通过更新 谷歌服务插件(有关最新版本的信息是 可在此处获得( 或将 com.google.android.gms 的版本更新到 8.3.0。
我已经完成了我发现的所有事情。
dependencies {
// This does not break the build when Android Studio is missing the JRebel for Android plugin.
classpath 'com.zeroturnaround.jrebel.android:jr-android-gradle:1.0.+'
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
classpath 'com.google.gms:google-services:2.0.0-alpha3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
并在应用程序中 gradle
compile 'com.google.android.gms:play-services:8.4.0'
将这些依赖项用于项目 build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
classpath 'com.google.gms:google-services:2.0.0-alpha3'
}
并将其放在应用级 build.gradle 文件的末尾(在依赖项之后(。
apply plugin: 'com.google.gms.google-services'
我不知道为什么把它放在最后(而不是开头(可以解决错误。
编辑 5/1/2016
还行。。。所以试图结束你们在我的解决方案中面临的所有问题
这是我的最终应用级别成绩
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "your-app-name"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:design:23.1.1'
compile 'com.mcxiaoke.volley:library:1.0.6@aar'
}
apply plugin: 'com.google.gms.google-services'
这是我的最终项目级别毕业
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
classpath 'com.google.gms:google-services:2.0.0-alpha3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
将其与您自己的 gradle 文件进行比较,并添加或修改与我编写的不同的任何值。
在应用程序的模块 (build.gradle( 中
移动:
apply plugin: 'com.google.gms.google-services'
到最后一行解决了问题。
执行以下操作:
-
将以下内容放入您的build.gradle(应用程序级gradle文件(
dependencies { classpath 'com.android.tools.build:gradle:2.0.0-beta2' classpath 'com.google.gms:google-services:2.0.0-beta2' }
请在此处查看最新版本,因为这会不断变化。
- 如果您收到以下错误消息,则需要将 gradle 包装器升级到 gradle-wrapper.properties 中的最新包装器。我使用的是 2.10。
插件太旧,请更新到更新的版本,或设置ANDROID_DAILY_OVERRIDE环境变量
-
将以下行放在build.gradle(模块级gradle文件(的底部
apply plugin: 'com.google.gms.google-services
似乎可以通过Google服务插件的3.0.0版本(以及Google Play服务库的9.0.0版本(修复。所以有了这个
顶级构建.gradle
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
}
App Level build.gradle
apply plugin: 'com.google.gms.google-services'
dependencies {
compile 'com.google.android.gms:play-services:9.0.0
}
快速旁注:如果您要更新到 google-services
插件的版本 3.0.0,请确保重新生成配置文件,因为它具有新字段(在此处解释(。
编辑(2016-06-20(:虽然这确实可以编译和运行,但我刚刚注意到在构建日志中它确实指定将插件放在文件底部,否则将使用默认值(9.0.0(。因此,在上述情况下,这不是问题,因为我使用的是9.0.0版本,但是在更新依赖项时可能会出现问题。这是日志:
google-services plugin could not detect any version for com.google.android.gms or com.google.firebase, default version: 9.0.0 will be used.
please apply google-services plugin at the bottom of the build file.
只工作:
顶级。
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:3.0.0'
}
应用级别:
dependencies {
compile 'com.google.android.gms:play-services-gcm:9.0.1'
compile 'com.google.android.gms:play-services-location:9.0.1'
}
// should be at the bottom
apply plugin: 'com.google.gms.google-services'
在官方示例中找到
在格拉德尔项目中
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha9'
classpath 'com.google.gms:google-services:2.0.0-alpha9'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
应用内 Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.google.samples.quickstart.signin"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'LICENSE.txt'
}
// Resolve dependency differences between app and tests
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:23.1.1'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
// Dependency for Google Sign-In
compile 'com.google.android.gms:play-services-auth:8.4.0'
// UiAutomatorTesting
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
androidTestCompile 'com.android.support:support-annotations:23.1.1'
}
apply plugin: 'com.google.gms.google-services'
我已经在app build.gradle中更新了
dependencies {
....
compile 'com.google.android.gms:play-services-auth:9.0.0'
和应用程序构建.gradle
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:3.0.0'
}
它的工作。
就我而言,我已经删除了"应用插件:'com.google.gms.google-services'"从gradle.build的末尾开始,它的工作正常。
重要的是将 Gradle 设置为 2.10 版
https://stackoverflow.com/a/35188079/570168
我在撒娇...在谷歌页面上有解决方案...https://developers.google.com/android/guides/google-services-plugin#introduction
为已启用的服务所需的基本库添加依赖项。此步骤要求应用插件:"com.google.gms.google-services">行位于 app/build.gradle 文件的末尾,以免引入依赖项冲突。您可以通过运行 ./gradlew :app:dependencies 来查看此步骤的结果。
将应用插件:'com.google.gms.google-services
' 移动到 build.gradle 的末尾没有任何意义。这与不定义它相同。
只需删除此行并确保应用插件:"com.android.application
"在那里
用:
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services:8.4.0'
它将编译。
在项目中 gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:2.0.0-alpha6'
}
}
在应用/模块中
apply plugin: 'com.google.gms.google-services'
android {
...
}
dependencies {
compile 'com.google.android.gms:play-services-analytics:8.3.0'
}
在项目gradle中:
compileSdkVersion 23
它正在工作。
修复它的说明。
- 更改为在应用
build.gradle
中使用compile 'com.google.android.gms:play-services-location:8.3.0'
apply plugin: 'com.google.gms.google-services'
移至应用build.gradle
末尾- 在项目
build.gradle
依赖项中使用classpath 'com.google.gms:google-services:2.0.0-alpha3'
- 更改为在
gradle/wrapper/gradle-wrapper.properties
中使用gradle-2.8