代码之家  ›  专栏  ›  技术社区  ›  Bram Vanbilsen

com.google.gms网站:google services与Firebase插件的兼容性问题

  •  0
  • Bram Vanbilsen  · 技术社区  · 6 年前

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

    失败:生成失败,出现异常。

    出了什么问题:

    图书馆com.google.android.gms:游戏服务基地是其他库在[[15.0.1,15.0.1]]中请求,但解析为11.8.0。禁用插件并使用./gradlew:应用程序:依赖关系。

    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 当然,它们看起来像自动取款机:

    Android级别生成.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
    }
    

    应用程序级别生成.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 回复  |  直到 6 年前
        1
  •  0
  •   Khalid Taha    6 年前

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