gpt4 book ai didi

android - Flutter中的Image_picker依赖项不允许我使用错误消息编译应用

转载 作者:行者123 更新时间:2023-12-03 03:38:00 25 4
gpt4 key购买 nike

我想为我的App注册添加image_picker库,当用户单击按钮时可以在其中选择图像。我的依赖

dependencies:
flutter:
sdk: flutter
provider: ^3.2.0
firebase_auth: ^0.15.2
password_strength: ^0.1.2
keyboard_avoider: ^0.1.2
image_picker: ^0.6.2+3

一切正常,但是在pubspec.yaml中添加了image_picker之后,我得到了错误:

FAILURE: Build failed with an exception.


  • 出了什么问题:
    任务':app:preDebugBuild'的执行失败。

    Android dependency 'androidx.lifecycle:lifecycle-runtime' has different version for the compile (2.0.0-rc01) and runtime (2.0.0) classpath. You should manually set the same version via DependencyResolution

  • 尝试:
    使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。与--scan一起运行以获取完整的见解。
  • https://help.gradle.org上获得更多帮助

  • 1秒内失败
    由于插件中的AndroidX不兼容,构建失败。该工具将尝试使用Jetfier解决不兼容问题。
    正在构建插件firebase_auth ...

    失败:生成失败,发生异常。
  • 出了什么问题:
    配置根项目“firebase_auth”时发生问题。

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

  • 尝试:
    使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。与--scan一起运行以获取完整的见解。
  • https://help.gradle.org上获得更多帮助

  • 0秒内失败
    由于上述问题,无法构建插件firebase_auth。
    退出(sigterm)

    编辑:
    Flutter doctor -v输出
    PS D:\Flutter Projekte\helper> flutter doctor -v
    [√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.18362.535], locale de-DE)
    • Flutter version 1.12.13+hotfix.5 at C:\src\flutter
    • Framework revision 27321ebbad (6 days ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0


    [!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at C:\Users\Ozan\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

    [√] Android Studio (version 3.5)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 40.2.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

    [!] IntelliJ IDEA Community Edition (version 2019.2)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2.2
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
    https://flutter.dev/intellij-setup/#installing-the-plugins

    [√] VS Code (version 1.41.0)
    • VS Code at C:\Users\Ozan\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.7.1

    [√] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

    ! Doctor found issues in 2 categories.

    flutter 医生-安卓许可证输出
    flutter doctor --android-licenses
    Warning: Observed package id 'extras;intel;Hardware_Accelerated_Execution_Manager' in inconsistent location 'C:\Users\Ozan\AppData\Local\Android\Sdk\.temp\PackageOperation01' (Expected 'C:\Users\Ozan\AppData\Local\Android\Sdk\extras\intel\Hardware_Accelerated_Execution_Manager')
    Warning: Observed package id 'extras;intel;Hardware_Accelerated_Execution_Manager' in inconsistent location 'C:\Users\Ozan\AppData\Local\Android\Sdk\.temp\PackageOperation01' (Expected 'C:\Users\Ozan\AppData\Local\Android\Sdk\extras\intel\Hardware_Accelerated_Execution_Manager')
    Warning: File C:\Users\Ozan\.android\repositories.cfg could not be loaded.
    All SDK package licenses accepted.======] 100% Computing updates...

    local.properties文件
    sdk.dir=C:\\Users\\Ozan\\AppData\\Local\\Android\\sdk
    flutter.sdk=C:\\src\\flutter
    flutter.buildMode=debug
    flutter.versionName=1.0.0
    flutter.versionCode=1

    最佳答案

    将flutter更新为默认情况下使用AndroidX的1.12版本:

    https://flutter.dev/docs/development/tools/sdk/release-notes/release-notes-1.12.13#android

    您可以通过执行以下命令进行升级:

     flutter upgrade

    进行flutter升级后,然后将sdk路径添加到android_home:
    export ANDROID_HOME="YOUR_SDK_PATH" 

    同时升级 build.gradle和kotlin版本中的android gradle:
    dependencies {
    classpath 'com.android.tools.build:gradle:3.3.1'
    }

    关于android - Flutter中的Image_picker依赖项不允许我使用错误消息编译应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59374907/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com