【问题标题】:Could not find the firebase_core FlutterFire plugin error displayed when building Flutter project构建 Flutter 项目时找不到 firebase_core FlutterFire 插件错误
【发布时间】:2021-06-28 11:39:42
【问题描述】:

我在构建 Flutter 项目时遇到以下错误: *评估项目“:firebase_ml_vision”时出现问题。

找不到 firebase_core FlutterFire 插件,您是否已将其作为依赖项添加到您的 pubspec*

这是否意味着我必须安装一些额外的库?我只想在我的项目中使用 ML Vision。感谢您的帮助。

我的 pubspec.yaml 文件:

dependencies:
  flutter:
    sdk: flutter
  get: ^3.24.0

  firebase_ml_vision: ^0.11.0
  image_picker: ^0.6.3+4
  image_cropper: 1.0.2

build.gradle(应用程序):

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

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.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

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

android {
    compileSdkVersion 30

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.grobonet"
        minSdkVersion 16
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    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
        }
    }
}

flutter {
    source '../..'
}

build.gradle(项目)

buildscript {
    repositories {
        google()
        jcenter()
    }

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

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
}

【问题讨论】:

    标签: flutter firebase-mlkit mlvision


    【解决方案1】:

    firebase_core 添加到您的项目中。

    【讨论】:

    • 添加后我有另一个错误:因为来自 sdk 的 integration_test 的每个版本都依赖于元 1.3.0-nullsafety.6 并且 firebase_core >=1.0.0 依赖于元 ^1.3.0,来自 sdk 的 integration_test与 firebase_core >=1.0.0 不兼容。因此,因为 grobonet 依赖于 sdk 中的 firebase_core ^1.0.2 和 integration_test any,所以版本求解失败。 pub get failed (1; 所以,因为 grobonet 依赖于 firebase_core ^1.0.2 和 integration_test any from sdk,版本解决失败。)
    • 这是一个新错误,意味着当前版本的依赖项不能一起工作,要么降级一些,要么升级一些。你在使用带有 null-safey 的 Flutter 吗?尝试使用firebase_core: ^0.7.0
    • 或使用get: ^4.1.1firebase_core: ^1.0.2。这些导致您的错误,请尝试并报告。
    猜你喜欢
    • 2021-10-07
    • 2020-06-06
    • 2022-07-28
    • 2021-08-08
    • 2021-08-06
    • 1970-01-01
    • 2010-09-24
    • 2021-06-05
    • 2020-01-04
    相关资源
    最近更新 更多