Flutter: Exception in thread “main” java.util.zip.ZipException: error in opening zip file

I created a new flutter project in android studio 3.5, but facing error

Exception in thread "main" java.util.zip.ZipException: error in opening zip file

Efforts for the solution: this, this but did not work for me.

Solution to answer:

  1. Browse to the official Gradle Distributions webpage and check what is the latest version of gradle all.zip file, for example (at the time of writing) gradle-6.7-all.zip and copy the address

  2. Go to your Flutter project drop down,

    drop down android>gradle>wrapper

  3. Select gradle-wrapper-properties

  4. Paste the URL you copied earlier. For example,

    distributionurl=https://services.gradle.org/distributions/gradle-6.7-all.zip