1

I just imported the package background_location, and didn't use it. 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.

Shanu
  • 311
  • 2
  • 16

1 Answers1

0

Here are a few things you can do:

  1. run flutter clean and flutter pub get and then try again.
  2. go to your android/app/build.gradle and upgrade the Kotlin version. Latest right now is 1.6.0 i.e. 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

This is where I got these solutions from, Flutter: Execution failed for task ':app:compileDebugKotlin'.

Update: Change your dependency in your pubspec.yaml to:

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