Skip to content

Problem when running flutter app with isolates on disconnected android phone #4066

@jlabeit

Description

@jlabeit

Describe the bug
When using the VSCode extension to start flutter applications on android devices without debugging and then disconnecting the android device it seems that isolates are not started properly anymore.

The following line of code in the provided example app is not being executed anymore:

    await compute(mockJob, null);

When running the same app simply with flutter run everything works as expected.

To Reproduce
Steps to reproduce the behavior:

  1. Checkout this example flutter app.
  2. Connect an android device via USB.
  3. Run the example app with VSCode Flutter + Dart extension in mode "Run without debugging".
  4. After the app starts disconnect the USB.
  5. Click on the button "press" in the app and see nothing happens.

Note, providing logs is a bit hard because when the device stays connected to USB and attached then the problem doesn't occur.

Expected behavior
When pressing the "press" button the text should change.
Note, the behavior works as expected when running the app with the command flutter run in debug or not debug mode.

Screenshots
Running the app with:
Peek 2022-07-21 22-42

The expected output of the app after pressing the button:
image

Please complete the following information:

  • Operating System and version: Arch Linux
  • VS Code version: 1.68.0
  • Dart extension version: 3.44.0
  • Dart/Flutter SDK version: 2.10.5
  • Target device (if the issue relates to Flutter debugging): Pixel 4a (Android API 32)

Flutter doctor

[✓] Flutter (Channel unknown, 2.10.5, on ArchLabs Linux 5.18.7-arch1-1, locale en_US.utf8)
    • Flutter version 2.10.5 at /opt/flutter
    • Upstream repository unknown
    • Framework revision 5464c5bac7 (3 months ago), 2022-04-18 09:55:37 -0700
    • Engine revision 57d3bac3dd
    • Dart version 2.16.2
    • DevTools version 2.9.2

[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /home/julian/Android/Sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (version 2021.2)
    • Android Studio at /opt/android-studio
    • Flutter plugin version 68.1.2
    • Dart plugin version 212.5744
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] Connected device (1 available)
    • Pixel 4a (mobile) • 18101JEC203597 • android-arm64 • Android 12 (API 32)

[✓] HTTP Host Availability
    • All required HTTP hosts are available

Metadata

Metadata

Assignees

No one assigned

    Labels

    in debuggingRelates to the debug adapter or process of running debug sessionsin flutterRelates to running Flutter appsis bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions