Initializing Gradle is taking forever on android studio for Flutter project

前端 未结 7 2304
遇见更好的自我
遇见更好的自我 2021-01-03 22:16

I\'m trying to run a hello world flutter app for the first time on my device, but when I hit run on android studio, it shows initilizing gradle, and it stays like that for m

7条回答
  •  情书的邮戳
    2021-01-03 23:07

    I've faced the same problem, and my internet is currently very slow, so I solved it by changing the gradle in flutter project to an already downloaded one. Just follow these steps:

    1. Go to C:\Users\YOUR_USER_NAME\.gradle\wrapper\dists

    2. You should find one or more folders with the name of the distribution (for example with the name "gradle-4.6-all" if you were developing in Android Studio previously), choose one of these folders (make sure it is not empty) and copy its name.

    3. Open Android Studio project explorer, and locate android\gradle\wrapper\gradle-wrapper.properties

    4. You will find a line like this:
      distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
      Change gradle-5.4.1-all with the folder name you copied in step 2.

    5. Run your app, and hopefully it works this time.

提交回复
热议问题