Skip to content

Add option to not uninstall in flutter test command #166709

Closed

Description

@ScorpiosCrux

Use case

On Android, I have a DPM application where the application cannot be uninstalled. It can only be updated.

I am trying to write integration tests to run on a physical device. However, the flutter test command will try to uninstall the DPM app.

I get the error

db uninstall failed: ProcessException: Process exited abnormally with exit code 1:
Failure [DELETE_FAILED_DEVICE_POLICY_MANAGER]
  Command: /home/name/Android/Sdk/platform-tools/adb -s 9d3dd4405f4f260c uninstall com.org.example

Please provide a way around this.

Proposal

Ideally, I want a command in flutter test which will skip the uninstallation step.

Activity

  1. darshankawar commented on Apr 8, 2025

    @darshankawar
    Member

    @ScorpiosCrux
    I see that while running flutter drive, there's an option as below:

    --[no-]keep-app-running                                  Will keep the
                                                                 Flutter application
                                                                 running when done
                                                                 testing.
                                                                 By default,
                                                                 "flutter drive"
                                                                 stops the
                                                                 application after
                                                                 tests are finished,
                                                                 and
                                                                 "--keep-app-running
                                                                 " overrides this.
    

    But I don't see the same for flutter test. Maybe you can try as mentioned in this comment and instead of flutter uninstall, try flutter install to see if it helps in your case or not ?

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Apr 8, 2025
  3. ScorpiosCrux commented on Apr 8, 2025

    @ScorpiosCrux
    Author

    @darshankawar
    flutter install actually tries to uninstall the app first. This does not help
    adb uninstall app.name Also runs into the same issue.
    flutter run does not try to uninstall, but it does install the application correctly.

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Apr 8, 2025
  5. added
    a: tests"flutter test", flutter_test, or one of our tests
    c: new featureNothing broken; request for a new capability
    toolAffects the "flutter" command-line tool. See also t: labels.
    frameworkflutter/packages/flutter repository. See also f: labels.
    c: proposalA detailed proposal for a change to Flutter
    and removed
    in triagePresently being triaged by the triage team
    on Apr 9, 2025
  6. added
    team-toolOwned by Flutter Tool team
    and removed on Jun 5, 2025
  7. added
    P3Issues that are less important to the Flutter project
    triaged-toolTriaged by Flutter Tool team
    on Jul 29, 2025
  8. bkonyi commented on Jul 29, 2025

    @bkonyi
    Contributor

    This seems like a valid use case, but I don't think we're going to have cycles in the near future to work on this. I'd be happy to review and accept a PR if you're willing to contribute the change!

  9. added a commit that references this issue on Feb 24, 2026
    04db01f
  10. added a commit that references this issue on Feb 27, 2026
    362a502
  11. github-actions commented on Mar 10, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  12. locked as resolved and limited conversation to collaborators on Mar 10, 2026
  13. added a commit that references this issue on Mar 26, 2026
    58b19b3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: tests"flutter test", flutter_test, or one of our testsc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.team-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions