[英]Flutter run stuck at "Installing build\...\app.apk" if run by VS Code
I'm trying to run a Flutter app on a physical Android device using Visual Studio Code with the Dart Code/Flutter extension (which used to work).我正在尝试使用带有Dart Code/Flutter 扩展(曾经可以工作)的 Visual Studio Code 在物理 Android 设备上运行 Flutter 应用程序。
But when I try to start the app, it is stuck at Installing build\\app\\outputs\\apk\\app.apk...
and a white screen appears on my phone.但是当我尝试启动应用程序时,它卡在
Installing build\\app\\outputs\\apk\\app.apk...
并且我的手机上出现白屏。
I know that there are already a number of threads on this topic 1 2 3 , but the suggested solutions did not work for me, including:我知道已经有很多关于这个主题的主题1 2 3 ,但建议的解决方案对我不起作用,包括:
flutter clean
flutter build
, manually installing the app-debug.apk
* and then starting the app from VS Code againflutter build
应用程序,手动安装app-debug.apk
* 然后再次从 VS Code 启动应用程序adb uninstall
and installing app.apk
using adb install
adb uninstall
卸载应用程序并使用adb install
安装app.apk
*after installing the APK file myself, the app worked, but of course I had no debugging capabilities *在自己安装 APK 文件后,该应用程序可以运行,但当然我没有调试功能
When I execute flutter run
in the terminal, the app opens on my phone and works fine.当我在终端中执行
flutter run
时,该应用程序在我的手机上打开并且工作正常。 However hot reload does not work and only the following is printed out:但是热重载不起作用,只打印出以下内容:
$ flutter run -d FA685YJ01209
Launching lib/main.dart on HTC One M9 in debug mode...
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 4.0s
✓ Built build/app/outputs/apk/debug/app-debug.apk.
It is not possible to attach to that process from Visual Studio Code either.也无法从 Visual Studio Code 附加到该进程。
I also tried to start the app on an emulator using Visual Studio Code.我还尝试使用 Visual Studio Code 在模拟器上启动该应用程序。 In that case, it gets stuck at
Syncing files to device Android SDK built for x86...
.在这种情况下,它会卡在将
Syncing files to device Android SDK built for x86...
。
$ flutter doctor -v
[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Linux, locale en_US.UTF-8)
• Flutter version 1.12.13+hotfix.8 at /opt/flutter
• Framework revision 0b8abb4724 (7 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /home/scriptim/Dev/Android/SDK/
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.3
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[!] Android Studio (version 3.6)
• Android Studio at /opt/android-studio
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] Connected device (1 available)
• HTC One M9 • FA685YJ01209 • android-arm64 • Android 7.0 (API 24)
! Doctor found issues in 1 category.
Apparently there were changes on the stable branch that solved the problem.显然, 稳定分支上的变化解决了这个问题。 After a
git pull
everything works fine.在
git pull
一切正常。 Unfortunately I can't figure out where exactly the problem was.不幸的是,我无法弄清楚问题出在哪里。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.