簡體   English   中英

Flutter 中的 Image_picker 依賴項不允許我使用錯誤消息編譯我的應用程序

[英]Image_picker dependency in Flutter doesn't let me compile my app with an Error message

我想為我的應用程序注冊添加 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:構建失敗,出現異常。

  • 出了什么問題:任務“:app:preDebugBuild”的執行失敗。

    Android 依賴項“androidx.lifecycle:lifecycle-runtime”對於編譯 (2.0.0-rc01) 和運行時 (2.0.0) 類路徑具有不同的版本。 您應該通過 DependencyResolution 手動設置相同的版本

  • 嘗試:使用 --stacktrace 選項運行以獲取堆棧跟蹤。 使用 --info 或 --debug 選項運行以獲得更多日志輸出。 使用 --scan 運行以獲得完整的見解。

  • https://help.gradle.org獲取更多幫助

BUILD FAILED in 1s 構建失敗可能是由於插件中的 AndroidX 不兼容。 該工具即將嘗試使用Jetfier來解決不兼容問題。 構建插件 firebase_auth...

FAILURE:構建失敗,出現異常。

  • 出了什么問題:配置根項目“firebase_auth”時出現問題。

    未找到 SDK 位置。 使用 local.properties 文件中的 sdk.dir 或 ANDROID_HOME 環境變量定義位置。

  • 嘗試:使用 --stacktrace 選項運行以獲取堆棧跟蹤。 使用 --info 或 --debug 選項運行以獲得更多日志輸出。 使用 --scan 運行以獲得完整的見解。

  • https://help.gradle.org獲取更多幫助

BUILD FAILED in 0s 由於上述問題,無法構建插件 firebase_auth。 退出(sigterm)

編輯:顫振醫生 -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 doctor -- android-licenses 輸出

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 中的 android build.gradle和 kotlin 版本:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM