adb Verified current stable Not installed? System Operations

Adb / Uninstall Package Keep Data

Uninstall Package Keep Data

Use 'adb uninstall -k com.example.app' to remove an app while retaining data; useful for persistent state testing.

$
Terminal
adb uninstall -k <com.example.app>

When To Use

Utilize this command when troubleshooting application stability issues that require repeated clean installs without losing user-generated data. It's particularly vital during regression tests or when fixing a bug affecting user data consistency in apps.

Pro Tip

Before using this command, ensure the app's data is not corrupted, as reinstalling could perpetuate latent issues. In some cases, reinstallation conflicts can arise if app versioning is misaligned.

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
Package com.example.app successfully uninstalled.\nUser data preserved!

Anatomy of Output

Understanding the result

Success Success Message

Indicates the app was successfully uninstalled but its data remains intact.

Failure Failure Message

Indicates an issue occurred, possibly related to insufficient permissions or device state.

Troubleshooting

Common pitfalls

Failure [DELETE_FAILED_INTERNAL_ERROR]

Solution: Check if the package manager has the necessary permissions or if the device is in a stable state.

device unauthorized

Solution: Ensure adb debugging is authorized on the device.

error: device offline

Solution: Verify that the device is properly connected and recognized by adb.

Command Breakdown

What each part is doing

adb
Base Command
The executable that performs this operation. Here it runs Adb before the shell applies any redirect operators.
<com.example.app>
com.example.app
The value supplied for com.example.app.
-k
Command Option
Tool-specific option used by this command invocation.

How To Run

Execution path

  1. Step 1

    Connect your Android device via USB and ensure USB debugging is enabled.

  2. Step 2

    Run the command: `adb uninstall -k com.example.app`

  3. Step 3

    Verify the package is removed while data is intact by checking with `adb shell pm list packages`.

Alternative Approaches

Comparable commands in other tools

Alternative system operations tools for the same job.