簡體   English   中英

使用時出錯 flutter background_location package

[英]Error while using flutter background_location package

我只是導入了 package background_location ,並沒有使用它。 即使我收到此錯誤


* What went wrong:
Execution failed for task ':background_location:compileDebugKotlin'.
> Compilation error. See log for more details

* 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 43s
Exception: Gradle task assembleDebug failed with exit code 1

嘗試更改 kotlin 版本,更改 minSdkVersion 但沒有變化。

您可以執行以下操作:

  1. 運行 flutter clean 和 flutter pub get 然后重試。
  2. go 到你的 android/app/build.gradle 並升級 Kotlin 版本。 現在最新的是 1.6.0 即ext.kotlin_version = '1.6.0'
  3. Go 到 android/gradle/wrapper/gradle-wrapper.properties 並將 distributionURL 升級到distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip

這是我從Flutter: Execution failed for task ':app:compileDebugKotlin'獲得這些解決方案的地方。

更新:將 pubspec.yaml 中的依賴項更改為:

background_location: 
    git:
      url: https://github.com/hilalbaig/background_location.git
      ref: master

這里是參考: https://github.com/Almoullim/background_location/issues/150#issuecomment-1132144094

暫無
暫無

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

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