Mahdyar's Blog

My Thoughts

Fixing “Execution failed for task ‘:sqflite'” in flutter

Hey there, I’m going to explain how I fixed “Fixing “Execution failed for task ‘:sqflite'” in this article.

recently I’ve been trying Flutter and for my first application I wanted to write something easy, so I decided it to be a “note app”.

A note app, requires database and that’s where the problem began.

In Android apps, SQLite is quite popular, because it’s fast, lightweight, and easy to manage.

so if you wanna use database in your Flutter app, you should add sqflite to your dependencies:

dependencies:
  flutter:
    sdk: flutter
  sqflite:
  path:

Flutter documentation has completely explained it, but it doesn’t work. at least it didn’t for me.

I added sqflite to my dependencies and ran the following command:

flutter pub get 

then, I ran the app and It came out:

* What went wrong:
Execution failed for task ':sqflite:extractDebugAnnotations'.
> Could not resolve all files for configuration ':sqflite:lintClassPath'.
   > Could not find lint-gradle.jar (com.android.tools.lint:lint-gradle:26.5.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle/26.5.0/lint-gradle-26.5.0.jar
   > Could not find lint.jar (com.android.tools.lint:lint:26.5.0).
     Searched in the following locations:
   > Could not find lint-checks.jar (com.android.tools.lint:lint-checks:26.5.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-checks/26.5.0/lint-checks-26.5.0.jar
   > Could not find lint-api.jar (com.android.tools.lint:lint-api:26.5.0).
         https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-api/26.5.0/lint-api-26.5.0.jar
   > Could not find intellij-core.jar (com.android.tools.external.com-intellij:intellij-core:26.5.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/intellij-core/26.5.0/intellij-core-26.5.0.jar
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/26.5.0/kotlin-compiler-26.5.0.jar
   > Could not find uast.jar (com.android.tools.external.org-jetbrains:uast:26.5.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/external/org-jetbrains/uast/26.5.0/uast-26.5.0.jar

* 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

So how did I fix it?

I simply (FYI: it took an hour for me to figure it out) fixed it by upgrading my Gradle version to the latest one (appended to android/gradle/wrapper/gradle-wrapper.properties) :

distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

and (appended to android/build.gradl):

classpath 'com.android.tools.build:gradle:4.0.0'

afterward Fixing “Execution failed for task ‘:sqflite’ happened and my problem was fixed!

Hope this helps.

P.S: If you’re reading it later you can probably fix it by upgrading gradle to the latest version, whatever it is now.