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
- Open the Terminal and enter: javac –version to see your Java version
- Take the version number (for example: 21) and check the equivalent Gradle version on this table:
| Java Version | Gradle Version |
| 19 | 7.6 |
| 20 | 8.3 |
| 21 | 8.5 |
| 22 | 8.8 |
| 23 | 8.10 |
(if you can’t find your version on this table, check the official table on https://docs.gradle.org/current/userguide/compatibility.html)
- Open your project’s folder, then to go to Android/gradle/wrapper and open the file gradle-wrapper.properties
- 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
- Close and restart Visual Studio (or whatever IDE you’re using) to reload these settings