com.google.gms:google-services Firebase插件的兼容性问题

时间:2018-08-11 20:51:00

标签: android firebase flutter

今天试图更新一个旧项目,我遇到了一个问题(在Android上),我认为这与其中一个Firebase插件有关。 我不断收到以下错误:

  

失败:生成失败,发生异常。

     

出了什么问题:

     

各种其他库都在[[15.0.1,15.0.1]]请求库com.google.android.gms:play-services-base,但解析为11.8.0。禁用插件,并使用./gradlew:app:dependencies检查您的依赖关系树。

这是我pubspec文件中的片段,用于显示项目中的插件:

dependencies:
  flutter:
    sdk: flutter
  firebase_auth: ^0.5.18
  firebase_storage: ^1.0.1
  cloud_firestore: ^0.7.4
  firestore_helpers: ^2.0.5
  image_picker: ^0.2.0
  location: 1.1.6
  flutter_webview_plugin: 0.0.9+1
  font_awesome_flutter: 4.7.2
  flutter_map: ^0.0.1

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.0

此代码段显示了项目的当前状态,以及Firebase产品的所有新版本。
当然,我也确实更新了build.gradle文件,它们看起来像这样的atm:

Android级build.gradle文件:

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:4.0.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

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

应用程序级别的build.gradle文件:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withInputStream { stream ->
        localProperties.load(stream)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.3'

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.test.tester"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
        profile {
            matchingFallbacks = ['debug', 'release']
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'

我相信这是我根据文档所做的全部工作,但也许我错过了一些事情。
有谁知道如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

打开this link,其中包含您需要使用的Firebase库版本列表