You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VSCode中Flutter调试安装app-debug.apk失败求助

Flutter Android调试安装APK报错:Can't find service: package

我是VSCode上的Flutter Android开发新手,已完成Flutter官方安装步骤以及「运行示例Flutter应用」的前5步,但在VSCode中调试运行示例应用时出现如下错误:

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
√ Built build\app\outputs\flutter-apk\app-debug.apk
cmd: Failure calling service activity: Broken pipe (32)
Error: ADB exited with exit code 1
Performing Streamed Install

adb: failed to install C:\Users\baasi\test_drive\build\app\outputs\flutter-apk\app-debug.apk: cmd: Can't find service: package
Error launching application on sdk gphone64 x86 64.

执行flutter doctor -v的结果如下:

PS C:\Users\baasi\test_drive> flutter doctor -v
[√] Flutter (Channel stable, 3.22.2, on Microsoft Windows [Version 10.0.22631.3737], locale en-US)
    • Flutter version 3.22.2 on channel stable at C:\dev\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 761747bfc5 (2 weeks ago), 2024-06-05 22:15:13 +0200
    • Engine revision edd8546116
    • Dart version 3.4.3
    • DevTools version 2.34.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at C:\Users\baasi\AppData\Local\Android\sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: C:\Program Files\Android\Android Studio1\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0--11609105)
    • All Android licenses accepted.

[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2024.1)
    • Android Studio at C:\Program Files\Android\Android Studio1
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0--11609105)

[√] VS Code (version 1.90.2)
    • VS Code at C:\Users\baasi\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.90.0

[√] Connected device (3 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 15 (API 35) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.22631.3737]
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 126.0.2592.61

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

! Doctor found issues in 2 categories.

flutter doctor里的Chrome和Visual Studio问题与当前Android调试报错无关,按以下方法排查解决:

  • 重启ADB服务
    在PowerShell中执行:
    adb kill-server
    adb start-server
    
  • 重启Android模拟器
    关闭当前模拟器,从AVD管理器重新启动,或直接在模拟器内重启设备。
  • 切换模拟器系统版本
    当前使用的Android 15(API35)模拟器可能存在兼容性问题,尝试创建并使用API33或API34版本的模拟器测试。
  • 手动安装APK验证
    执行以下命令手动安装生成的APK,排查是打包问题还是ADB/模拟器问题:
    adb install C:\Users\baasi\test_drive\build\app\outputs\flutter-apk\app-debug.apk
    
  • 更新ADB工具
    打开Android SDK管理器,检查并更新Platform Tools到最新版本,确保ADB版本与模拟器兼容。

内容的提问来源于stack exchange,提问作者NGNL123

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 03:44:54