简体   繁体   English

使用时出错 flutter background_location package

[英]Error while using flutter background_location package

I just imported the package background_location , and didn't use it.我只是导入了 package background_location ,并没有使用它。 Even though I get this error即使我收到此错误


* 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

Tried changing kotlin version, changed minSdkVersion but no change.尝试更改 kotlin 版本,更改 minSdkVersion 但没有变化。

Here are a few things you can do:您可以执行以下操作:

  1. run flutter clean and flutter pub get and then try again.运行 flutter clean 和 flutter pub get 然后重试。
  2. go to your android/app/build.gradle and upgrade the Kotlin version. go 到你的 android/app/build.gradle 并升级 Kotlin 版本。 Latest right now is 1.6.0 ie ext.kotlin_version = '1.6.0'现在最新的是 1.6.0 即ext.kotlin_version = '1.6.0'
  3. Go to android/gradle/wrapper/gradle-wrapper.properties and upgrade distributionURL to distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip Go 到 android/gradle/wrapper/gradle-wrapper.properties 并将 distributionURL 升级到distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip

This is where I got these solutions from, Flutter: Execution failed for task ':app:compileDebugKotlin' .这是我从Flutter: Execution failed for task ':app:compileDebugKotlin'获得这些解决方案的地方。

Update: Change your dependency in your pubspec.yaml to:更新:将 pubspec.yaml 中的依赖项更改为:

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

Here is the reference: https://github.com/Almoullim/background_location/issues/150#issuecomment-1132144094这里是参考: https://github.com/Almoullim/background_location/issues/150#issuecomment-1132144094

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 background_location 插件显示“应用程序正在运行”通知 - "App is running" notification is shown using background_location plugin flutter、kotlin gradle 使用位置 package 时出现问题 - flutter, kotlin gradle problem while using location package 在 flutter 中跟踪背景位置时使用 background_locator 插件时出现问题 - Issue while using background_locator plugin while tracking background location in flutter flutter 位置 package 在构建项目中有错误 - flutter location package have error in build project 在新位置软件包上运行Flutter会引发错误 - Flutter run on new location package throws error Flutter - 在后台应用时定期获取位置 state 并终止 state - Flutter - Periodic Location fetch while application in Background state and Terminate state Flutter 后台位置访问 - Flutter background location access 使用 Flutter 提供程序 package 时出现问题 - Problems while using Flutter Provider package 使用Fused Location API检索位置时无法处理android.intent.package_ADDED和REMOVED错误 - Couldn't handle android.intent.package_ADDED and REMOVED error while retrieving location using Fused Location API 安装位置 2.3.5 包时出现 Flutter 编译器错误 - Flutter compiler error when installing location 2.3.5 package
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM