[英]Execution failed for task ':app:processDebugGoogleServices' Firebase&Android Studio
[英]Android Studio - Execution failed for task ':app:processDebugGoogleServices'
在我的应用程序级别build.gradle文件中,声明了以下依赖项
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:mediarouter-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile "com.google.android.gms:play-services-gcm:10.2.1"
compile 'com.microsoft.azure:notification-hubs-android-sdk:0.4@aar'
compile 'com.microsoft.azure:azure-notifications-handler:1.0.1@aar'
}
...这使我收到所有10.2.1版本的警告,指出有可用的较新版本(11.0.1),我应该改用它。 因此,我将每个更新为指向11.0.1版本。 警告消失了,但是当我进行更改后尝试执行Project Sync时,出现以下错误,该错误基本上告诉我要返回10.2.1版。
错误:任务':app:processDebugGoogleServices'的执行失败。
请通过更新google-services插件的版本来解决版本冲突(有关最新版本的信息, 请访问https://bintray.com/android/android-tools/com.google.gms.google-services/ )或将com.google.android.gms的版本更新为10.2.1。
有人对为什么会这样有什么想法吗? 我的Android Studio完全是最新的,我不确定该怎么做。
在其他类似的帖子中,解决方案是在应用程序build.gradle文件的底部添加Apply apply plugin: 'com.google.gms.google-services'
,但是该apply plugin: 'com.google.gms.google-services'
已经存在。
完整的应用程序级别build.gradle文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.MYAPPIDHERE.android"
minSdkVersion 19
targetSdkVersion 25
versionCode 104
versionName = "1.4"
multiDexEnabled true
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles 'proguard-project.txt'
}
}
dexOptions {
preDexLibraries = false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:mediarouter-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile "com.google.android.gms:play-services-gcm:10.2.1"
compile 'com.microsoft.azure:notification-hubs-android-sdk:0.4@aar'
compile 'com.microsoft.azure:azure-notifications-handler:1.0.1@aar'
compile 'me.leolin:ShortcutBadger:1.1.4@aar'
}
repositories {
maven {
url "http://dl.bintray.com/microsoftazuremobile/SDK"
}
mavenCentral()
}
apply plugin: 'com.google.gms.google-services'
确保来自com.google.android.gms
组和com.google.firebase
组的依赖项具有相同的版本。
例如,当前的最新版本是11.0.1:
compile 'com.google.firebase:firebase-core:11.0.1' // <- This dependency must also have latest version
compile 'com.google.android.gms:play-services-location:11.0.1'
compile 'com.google.android.gms:play-services-maps:11.0.1'
compile 'com.google.android.gms:play-services-gcm:11.0.1'
在两个gradle文件中更新到最新版本
//项目lavel构建gradle
dependencies {
classpath 'com.google.gms:google-services:3.3.1'
}
//app lavel build gradle
dependencies {
implementation 'com.google.firebase:firebase-messaging:15.0.2'}
应用插件:“ com.google.gms.google-services”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.