每当我尝试运行Flutter程序时,它都会卡在“正在运行Gradle任务'assembleDebug”中

时间:2020-06-15 12:14:09

标签: android performance android-studio flutter android-sdk-tools

每当我尝试在仿真器或真实设备上运行时,它都会卡在“Running Gradle task 'assembleDebug”上,并且整个计算机都会死机并被卡住,唯一的出路就是硬重启它。

我正在使用华硕笔记本电脑(Windows 10),内存为16GB。

flutter --version给出:(当我尝试flutter upgrade时给出相同的结果并说我拥有最新版本)

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)

当我运行flutter doctor时,会在终端上得到以下输出: 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.

运行flutter doctor -v时得到以下输出:

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.

我还尝试运行flutter channel master并建议运行here,也尝试运行所有here

1 个答案:

答案 0 :(得分:1)

发生这种情况的原因有很多:不接受android许可证,不兼容的sdk / flutter版本,Windows防火墙等。

如果您没有尝试过:

使用以下文件更新了文件android / app / build.gradle

compileSdkVersion 29

运行: flutter clean

否则检查Flutter App stuck at "Running Gradle task 'assembleDebug'... "

或者如果您的Android license status unknown.

Android Studio installs without sdkmanager 取消选中“隐藏过时的软件包”,您将看到Android SDK工具(过时)26.1.1。 然后flutter doctor --android-licenses