javascript - 请通过使用 Firebase 使用 Google 更新我的 gradle 来修复版本冲突

标签 javascript android firebase firebase-authentication

将我的 google play 服务更新到 Firebase 后,我收到此错误。我不确定为什么会发生这种情况,因为它之前工作正常。

此消息不断出现:

Error:Execution failed for task ':app:processDebugGoogleServices'. Please fix the version conflict either by updating the version of the Google services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.

这是我的build.gradle文件

apply plugin: 'com.android.application'

android {
  compileSdkVersion 24
  buildToolsVersion '25.0.0'

  defaultConfig {
    applicationId "com.transcendencetech.juliospizzaprototype"
    minSdkVersion 10
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
  }
  buildTypes {
    release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  apply plugin: 'com.google.gms.google-services'



  compile 'com.android.support:appcompat-v7:24.1.1'
  compile 'com.google.firebase:firebase-auth:10.0.1'
  compile 'com.google.firebase:firebase-core:10.0.1'
  compile 'com.google.firebase:firebase-database:10.0.1'
  compile 'com.google.firebase:firebase-storage:10.0.1'
  compile 'com.firebaseui:firebase-ui:0.4.4'
  testCompile 'junit:junit:4.12'
}



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.3.3'
    classpath 'com.google.gms:google-services:3.1.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
  }
}

allprojects {
  repositories {
    jcenter()
  }
}

task clean(type: Delete) {
  delete rootProject.buildDir
}

最佳答案

https://firebase.google.com/docs/android/setup#manually_add_firebase

在您的 app/build.gradle 文件中:

dependencies {
  ...
}

移动这一行:apply plugin: 'com.google.gms.google-services' 到外面。

文档指示您将该行放在最底部。

关于javascript - 请通过使用 Firebase 使用 Google 更新我的 gradle 来修复版本冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44876121/

相关文章:

android - 如何从 Firebase 中仅获取新添加的数据?

javascript - 将字符串从 Obj-C 传递到 React Native

javascript - 在 js 中使用类与创建独立函数有什么好处

javascript - Phonegap iOS - 设备准备好不触发其他事件

javascript - 将变量传递给 Vue js 模态组件

java - Recyclerview 有条件点击

ios - 如何在 iOS 中获取 Firebase URL?

android - finish() 不触发 onActivityResult

android - 在 webview 中使用 javascript 加载 html

java - 看不懂View View 参数