'Flutter new project Fatal exit with error code 1

I have created and run successfully flutter project on my laptop, but every time when I have created a new project and run it that requires an internet connection,otherwise gives error "Exception: Gradle task assembleDebug failed with exit code 1"

And when I connected the laptop to the internet then it will download all sdk and dependencies again



Solution 1:[1]

Just change gradle and gradle wrapper in these 2 files in your project :

android/build.gradle:
classpath 'com.android.tools.build:gradle:4.1.0' to 4.0.2

android/gradle/wrapper/gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip to 6.4.1-all 

This is just a workaround, still looking for a real solution

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tomerpacific