Search code examples
androidperformanceandroid-studioflutterandroid-sdk-tools

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


whenever I try to run in on an Emulator or on a real device, it get stuck at “Running Gradle task 'assembleDebug” and the entire computer just freezes and get stuck, and the only way out is to hard reboot it.

I'm using an Asus laptop ( windows 10 ), with 16GB ram.

flutter --version gives: (when I try flutter upgrade it gives same result and says I have the latest version)

Flutter 1.20.0-1.0.pre.42 • channel master • https://github.com/flutter/flutter.git
Framework • revision 401690a64f (2 days ago) • 2020-06-12 19:45:48 -0700
Engine • revision 965fbbed17
Tools • Dart 2.9.0 (build 2.9.0-14.0.dev 2b917f5b6a)

when I run flutter doctor I get this output in the terminal: UPDATED

   C:\Users\Lidor>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, 1.20.0-1.0.pre.42, on Microsoft Windows [Version 10.0.18362.900], locale en-US)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 4.0)
[√] IntelliJ IDEA Community Edition (version 2019.2)
[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.

when I run flutter doctor -v I get this output:

C:\Users\Lidor>flutter doctor -v
[√] Flutter (Channel master, 1.20.0-1.0.pre.42, on Microsoft Windows [Version 10.0.18362.900], locale en-US)
    • Flutter version 1.20.0-1.0.pre.42 at D:\Study\P.Languages\Flutter\flutter_windows_v1.7.8+hotfix.4-stable\flutter
    • Framework revision 401690a64f (2 days ago), 2020-06-12 19:45:48 -0700
    • Engine revision 965fbbed17
    • Dart version 2.9.0 (build 2.9.0-14.0.dev 2b917f5b6a)

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at D:\Lidor\AppData\Local\Android\sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: D:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    X Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit
      https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions.

[√] Android Studio (version 4.0)
    • Android Studio at D:\Program Files\Android\Android Studio
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] IntelliJ IDEA Community Edition (version 2019.2)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2
    • Flutter plugin version 38.1.4
    • Dart plugin version 192.5728.98

[!] Connected device
    ! No devices available

! Doctor found issues in 2 categories.

I also tried to run flutter channel master as it suggested here and also everything here


Solution

  • There are lots of reasons why it's happening: Did not accept android-licenses, incompatible version of sdk/flutter, Windows Firewall etc.

    If you haven't tried:

    Updated file android/app/build.gradle with

    compileSdkVersion 29

    Run: flutter clean

    Otherwise check Flutter App stuck at "Running Gradle task 'assembleDebug'... "

    Or if your Android license status unknown.

    Android Studio installs without sdkmanager Uncheck Hide Obsolete Packages and you'll see Android SDK Tools (Obsolete) 26.1.1. and then flutter doctor --android-licenses