firebase - 将 image_picker 添加到在 flutter 中使用 firebase_auth 的应用程序时构建失败

标签 firebase flutter dart firebase-authentication imagepicker

当我使用 firebase_auth 时构建成功并且工作正常,当我开始在 flutter 中包含 image_picker 库时,突然构建崩溃了。这些是我尝试运行时遇到的错误:

 J:\flutter_projects\webdoc>flutter run --enable-software-rendering
Using software rendering with device AOSP on IA Emulator. You may get better performance with hardware mode by
configuring hardware rendering for your device.
Launching lib\main.dart on AOSP on IA Emulator in debug mode...
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'androidx.core:core' has different version for the compile (1.0.0) and runtime (1.0.2) classpath. You should manually set the same version via DependencyResolution

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 25s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                        26.0s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve
the incompatibility.
Building plugin firebase_auth...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done                    2.2s


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'firebase_auth'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s


The plugin firebase_auth could not be built due to the issue above. 

项目的版本是

  cupertino_icons: ^0.1.2
  firebase_auth: ^0.15.3
  flushbar: ^1.9.1
  image_picker: ^0.6.2+3
  http: ^0.12.0+2

我什至尝试使用 image_picker 0.4.12+1 也不起作用 我尝试设置 jetifier= false,但这并不能解决问题。

Build.gradle 是

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.2'
        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
}

最佳答案

android-gradle 更新为以下内容:

dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
}

并使用最新版本的 image_picker 即 0.6.2+3。

如果你也遇到如下错误:

SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable

然后您需要在终端中执行以下命令:

export ANDROID_HOME="YOUR_SDK_PATH"

关于firebase - 将 image_picker 添加到在 flutter 中使用 firebase_auth 的应用程序时构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59477228/

相关文章:

node.js - 我们如何使用 Angular 按时间戳数据类型对 Firebase Firestore 数据进行排序?

android - Flutter:不使用 AppBar 时如何在 Android 和 iOS 上更改状态栏文本颜色

firebase - 配置根项目 'firebase_auth' 时出现问题

Flutter 可关闭背景

flutter - 未找到用于签名配置 'release' 的 keystore

firebase - Firebase Crashlytics 控制台中缺少崩溃的堆栈跟踪

node.js - 如何从 Firebase 的云功能获取 strip 付款费用 'success'?

javascript - Firebase - 将对象推送到嵌套的对象列表中

flutter - 如何使单选按钮文本可点击?

dart - Flutter/Dart 基本了解