2

Please read carefully before flag as duplicate because I tried most of solution on the following questions.

Flutter App stuck at “Running Gradle task 'assembleDebug'… ”

when ever I try to run my Flutter program, it gets stuck at “Running Gradle task 'assembleDebug”

Why does assembleDebug takes much longer then project build and how to optimize it?

My app was working normally until the midday, when I trying to running on the emulator or my real/physical device the app is stuck on “Running Gradle task 'assembleDebug'… ”

The solutions that I tried to fix this issue

  1. Disabled the firewall and antivirus (Windows 10)

  2. flutter clean

  3. ./gradlew clean & ./gradlew build, these also get stuck, takes about more than 35 mins with no result after the commands!

  4. Deleted .idea and/or .gradle folders the back it again

  5. This answer "do flutter clean first then copy your project folder somewhere else close your project and open same project which is copied diffrent location. thats it!"

  6. flutter channel master changing flutter channel from stable to master and reverse it

Tried all the above and unfortunately still unsuccessful. I also tried on multiple physical devices in my home. I don't know what causes this issue or how to fix it!

error 1

enter image description here

wavecommander
  • 164
  • 15

1 Answers1

0

Its generally caused when there are some issues related to gradle build. For nearly a half day, I had the same problem, so I did the following:

  • Navigate to my Home and turn on show hidden folders. (if not visible by default)

  • Delete the folder named .gradle (it will be inside of android folder)

enter image description here

  • Execute the flutter run command after returning to Android Studio and launching the terminal.

flutter run command will recreate .gradle folder again, but with correct configuration.

  • The app will start running on your connected device once it's finished :)