Gradle threw an error while downloading artifacts from the network

Gradle threw an error while downloading artifacts from the network.

interesting error while building flutter app for Android.

“Gradle threw an error while downloading artifacts from the network .. Exception: Gradle task assembleDebug failed with exit code 1”

and this is my solution:)

  • locate flutter_app> android> gradle> wrapper directory
  • delete gradle-wrapper.jar. file
  • Edit gradle-wrapper.properties file
  • Change distributionUrl=https://services.gradle.org/distributions/gradle-x.x.x-all.zip to the latest file for my case “gradle-6.4.1-all.zip “