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

后端 未结 30 3404
你的背包
你的背包 2020-12-08 18:28

When I run the app it get stuck

Launching lib\\main.dart on Lenovo A319 in debug mode...
Running Gradle task \'assembleDebug\'...
(This is taking an unexpec         


        
相关标签:
30条回答
  • 2020-12-08 18:55

    There were two reasons for me on Archlinux:

    1. I needed to unset TERM which was set to xterm-256color (reference).
    2. For some reason, flutter stable was not working for me; so I switched to master with: flutter channel master && flutter upgrade. I'll be able to switch back to flutter stable when the fix in master makes its way into stable (reference).
    0 讨论(0)
  • 2020-12-08 18:55

    This is likely one of number of issues and some of the recommended troubleshooting can be found here.

    1. Check that you are building against an Android sdk that you have installed... in your build.gradle file check the compileSdkVersion.

    2. You can try uninstalling and reinstalling the relevant SDK.

    3. Some users have reported that they had to resintall Dart.

    Without a little more information basic troubleshooting is the best we can offer sorry.

    Good luck.

    0 讨论(0)
  • 2020-12-08 18:56

    flutter run -v showed that I was stuck on

    Downloading https://services.gradle.org/distributions/gradle-5.6.2-all.zip

    This was going to take hours, as for some reason the download speed was ~10kB/s on a decent DSL connection.

    Solution:

    1. Interrupt gradle build
    2. Download the required gradle zip from a fast mirror: https://distfiles.macports.org/gradle/gradle-5.6.2-all.zip
    3. Copy gradle-5.6.2-all.zip to C:\Users\ <MyUsername>\.gradle\wrapper\dists\gradle-5.6.2-all\9st6wgf78h16so49nn74lgtbb (of course the last folder will have a different name on your PC)
    4. flutter run and voilà.
    0 讨论(0)
  • 2020-12-08 18:56

    This helped: check if root/android/app/build.gradle SDK version is set to minimum 28 for: compileSdkVersion 28 and targetSdkVersion 28

    Occurs with import of Firestore.

    0 讨论(0)
  • 2020-12-08 18:57

    If you are on Windows: try adding firewall exceptions to your Android Studio.

    1. Go to:

      Control Panel\System and Security\Windows Defender Firewall\Allowed apps

    2. Hit the button:

      Allow another app

    3. Add your new firewall exceptions:

      studio.exe and studio64.exe

    I hope this can be useful for you too.

    0 讨论(0)
  • 2020-12-08 19:00

    If Running Gradle task assembledebug is taking unexpectedly long time, try updating Gradle in your project. (Downloading latest zip file)

    You can follow steps in this answer.

    Or try by:

    1. Open a project in Android Studio
    2. Right-click on android in Projects Panel
    3. Go down to Flutter and click on the 'Open Android module in Android Studio'.

    (See screenshot for reference)

    This should open the project as an Android Project.

    1. Now, click on 'gradle' in the right panel.
    2. Next, click on 'Execute Gradle Task' icon

    This should open a 'Run Anything' window.

    1. Now, Run the command gradlew clean
    2. and, then run gradlew build
    3. If prompted by Android Studio to 'Update Gradle Plugin', do that.

    The update would download the required .zip files. And, your apps should work fine after that.

    0 讨论(0)
提交回复
热议问题