等待VM服务端口可用

问题描述 投票:0回答:1

我尝试在具有 API 35 的 Android 模拟器上的 Android Studio 上运行默认应用程序,但每次运行 flutter run -v 命令时,该应用程序都会卡在行中:

Waiting for VM Service port to be available
,如果我执行
flutter run 
卡在
Built build/app/outputs/flutter-apk/app-debug.apk

flutter doctor 没有给我显示任何问题。这是

flutter doctor -v
的输出:

[✓] Flutter (Channel stable, 3.27.1, on openSUSE Leap 15.6 6.4.0-150600.21-default, locale en_US.UTF-8)
    • Flutter version 3.27.1 on channel stable at /home/farouk/flutter_android_dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 17025dd882 (2 days ago), 2024-12-17 03:23:09 +0900
    • Engine revision cb4b5fff73
    • Dart version 3.6.0
    • DevTools version 2.40.2

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /home/farouk/Android/Sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /home/farouk/flutter_android_dev/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /usr/bin/firefox

[✗] Linux toolchain - develop for Linux desktop
    ✗ clang++ is required for Linux development.
      It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/
    ✗ CMake is required for Linux development.
      It is likely available from your distribution (e.g.: apt install cmake), or can be downloaded from https://cmake.org/download/
    ✗ ninja is required for Linux development.
      It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from https://github.com/ninja-build/ninja/releases
    • pkg-config version 0.29.2
    ✗ GTK 3.0 development libraries are required for Linux development.
      They are likely available from your distribution (e.g.: apt install libgtk-3-dev)

[✓] Android Studio (version 2024.2)
    • Android Studio at /home/farouk/flutter_android_dev/android-studio
    • Flutter plugin version 83.0.3
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)

[✓] Connected device (3 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 15 (API 35) (emulator)
    • Linux (desktop)              • linux         • linux-x64      • openSUSE Leap 15.6 6.4.0-150600.21-default
    • Chrome (web)                 • chrome        • web-javascript • Mozilla Firefox 115.10.0esr

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

这是

flutter run -v
输出:

[  +14 ms] executing: /home/farouk/Android/Sdk/platform-tools/adb -s emulator-5554 shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x20000000 --ez enable-dart-profiling true --ez
enable-checked-mode true --ez verify-entry-points true com.example.untitled/com.example.untitled.MainActivity
[  +84 ms] Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x20000000 cmp=com.example.untitled/.MainActivity (has extras) }
[        ] Waiting for VM Service port to be available...

应用程序始终处于白屏状态,并带有 Flutter 徽标。

我发现很多人都有同样的问题,但他们的解决方案都不适合我,build.gradle中的包名称与manifest.xml和mainActivity中的名称相同

flutter dart android-studio android-emulator
1个回答
0
投票

尝试

flutter run --release
flutter run --profile
。如果也失败了,那么你的 adb 很可能已损坏。尝试重新安装adb。

哦,你也尝试过

flutter clean
吗?

© www.soinside.com 2019 - 2024. All rights reserved.