简体   繁体   English

如果通过 VS Code 运行,Flutter 运行会卡在“正在安装 build\\...\\app.apk”

[英]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 ,但建议的解决方案对我不起作用,包括:

  • Rebooting my phone and my computer重启我的手机和电脑
  • Uninstalling the app卸载应用程序
  • flutter clean
  • Building the app using flutter build , manually installing the app-debug.apk * and then starting the app from VS Code again使用flutter build应用程序,手动安装app-debug.apk * 然后再次从 VS Code 启动应用程序
  • Uninstalling the app using adb uninstall and installing app.apk using adb install使用adb uninstall卸载应用程序并使用adb install安装app.apk
  • Clearing cache and storing from the app settings before uninstalling卸载前从应用程序设置中清除缓存和存储
  • Revoking USB debugging authorizations撤销USB调试授权
  • Disabling Play Protect on my phone在我的手机上禁用Play Protect
  • Increasing the Logger Buffer Size in my phone's developer options在我手机的开发者选项中增加 Logger Buffer Size

*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.

相关问题 Flutter 在将 flutter 应用程序迁移到 AndroidX 后卡在安装 build\app\outputs\apk\app.apk - Flutter stuck at Installing build\app\outputs\apk\app.apk after migrating flutter app to AndroidX Flutter android 测试卡在安装 build/app/outputs/flutter-apk/app.apk - Flutter android testing stuck on installing build/app/outputs/flutter-apk/app.apk 我的 flutter 应用程序卡在“正在安装 build\app\outputs\apk\app.apk...”,然后什么也没有发生 - My flutter app is getting stuck at “Installing build\app\outputs\apk\app.apk…” and then nothing happens 卸载应用程序后卡在 Flutter 中安装 build\app\outputs\apk\app.apk... - Stuck at installing build\app\outputs\apk\app.apk in Flutter... after uninstalling the app 问题:安装 build/app/outputs/flutter-apk/app.apk - PROBLEM: Installing build/app/outputs/flutter-apk/app.apk 安装 build/app/outputs/flutter-apk/app.apk... 在 flutter 运行后丢失/没有发生。 设备上未保存任何应用 - Installing build/app/outputs/flutter-apk/app.apk... is missing / not happening after flutter run. No app is saved on device flutter build apk --split-per-abi: app-armeabi-v7a-release.apk 和 app.apk 有什么区别 - flutter build apk --split-per-abi: what is the difference between app-armeabi-v7a-release.apk and app.apk 使用 build apk 命令构建的 Flutter 应用程序无法运行特定于平台的代码 - Flutter app built with build apk command fails to run platform specific code 删除 .gradle 文件夹后,真机未安装 app.apk - Real device is not installing app.apk after deleting .gradle folder Flutter 无法从 app.apk 读取清单信息 - Flutter Unable to read manifest info from app.apk
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM