FLUTTER :solving generateLockfiles’ error

Error

The supplied phased action failed with an exception. Could not create task ‘:generateLockfiles’. Process ‘command ‘/Users/your-user-name/Flutter/project/android/gradlew” finished with non-zero exit value 1

Solution / Fix

  1. Open the Terminal and enter: javac –version to see your Java version
  2. Take the version number (for example: 21) and check the equivalent Gradle version on this table:
Java VersionGradle Version
197.6
208.3
218.5
228.8
238.10


(if you can’t find your version on this table, check the official table on https://docs.gradle.org/current/userguide/compatibility.html)

  1. Open your project’s folder, then to go to Android/gradle/wrapper and open the file gradle-wrapper.properties
  2. Go to the line “distributionUrl” and enter the correct gradle version. For example, if your Java Version is 21 and Gradle version is 8.5, this URL should be: distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
  3. Close and restart Visual Studio (or whatever IDE you’re using) to reload these settings

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *