【问题标题】:Gradle Error:Execution failed for task ':app:processDebugGoogleServices'Gradle 错误:任务“:app:processDebugGoogleServices”执行失败
【发布时间】:2016-02-07 22:26:19
【问题描述】:

我正在点击此链接将 Google 登录功能集成到我的 Android 应用中。https://developers.google.com/identity/sign-in/android/start-integrating 正如上面给定页面的最后一步中给出的,我们必须包含依赖项

 compile 'com.google.android.gms:play-services-auth:8.3.0' 

在应用程序级 build.gradle 文件中,但这样做并构建项目时出现错误提示

Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict.

build.gradle(Module:app)

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


android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.0.1'
    compile 'com.google.android.gms:play-services-auth:8.3.0'
}

在 build.gradle 文件中编译依赖行 compile 'com.google.android.gms:play-services-auth:8.3.0' 显示错误

所有 com.google.android.gms 库必须使用完全相同的版本 规范(混合版本可能导致运行时崩溃)。成立 版本 8.3.0、8.1.0。例子包括 com.google.android.gms:play-services-base:8.3.0 和 com.google.android.gms:play-services-measurement:8.1.0 有一些 库或工具和库的组合,它们是 不兼容,或者可能导致错误。一种这样的不兼容性是 使用不支持的 Android 支持库版本进行编译 最新版本(或者特别是低于您的 targetSdkVersion。)

这是 gradle build 的消息。

Information:Gradle tasks [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugAndroidTestSources, :social_buttons:generateDebugSources, :social_buttons:generateDebugAndroidTestSources, :social_buttons:compileDebugSources, :social_buttons:compileDebugAndroidTestSources]
:clean UP-TO-DATE
:app:clean
:social_buttons:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library
:app:prepareComAndroidSupportDesign2301Library
:app:prepareComAndroidSupportSupportV42301Library
:app:prepareComGoogleAndroidGmsPlayServicesAds810Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics810Library
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library
:app:prepareComGoogleAndroidGmsPlayServicesAuth830Library
:app:prepareComGoogleAndroidGmsPlayServicesBase830Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement830Library
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement810Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
Found com.google.android.gms:play-services-auth:8.3.0, but version 8.1.0 is needed
:app:processDebugGoogleServices FAILED
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict.
Information:BUILD FAILED
Information:Total time: 3.49 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

我看不到任何解决此版本冲突的方法。任何帮助表示赞赏。

【问题讨论】:

  • 请检查 play-services 9.4.0 是否仍然存在此问题。我相信他们修复了这个错误。
  • new android studio(2.3) 给了我这个错误。尽管我已经尝试了所有答案,但错误仍然存​​在
  • 每次 Gradle 升级都会导致问题 :(

标签: android gradle build.gradle


【解决方案1】:

如果您正在尝试为 firebase 解决此问题,请使用此....

删除** 'com.google.gms.google-services' **不是正确的方法,因为名称更改而出现此问题。

需要以firebase package name == android package name的格式给出相同的名称(在/android/app/src/main/AndroidManifest.xml中查看)

只需将名称更改为 android 包名称,然后再次下载 google-services.json,然后将其粘贴到 /android/app/ 中,就像这样 (/android/app/google-services.json) 并运行你的 npm 例如。 npx react-native run-android 它将 100% 工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-28
    • 1970-01-01
    • 2016-05-24
    • 2014-07-13
    相关资源
    最近更新 更多