adb Verified current stable Not installed? Programming

Adb / Clear Application Data Adb

Clear Application Data Adb

Clear application data for a specified package using adb shell.

$
Terminal
adb shell pm clear <package>

When To Use

Prior to reinstallation of applications to ensure a clean state before setup procedures or testing.

Pro Tip

Use the --user flag to clear data for a specific user on multi-user devices, avoiding unintended data loss for other users.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
adb shell pm clear <package>

Anatomy of Output

Understanding the result

Clearing data for package com.example.app: [INFO] Successfully cleared application data. Clear Status

Confirms that the data clear process has completed successfully.

Error: Package not found: com.example.app. Error Report

Informs that the specified package does not exist.

Data clear statistics: 1 package cleared, 0 errors. Statistics

Summary of the data clearing operation.

Power User Variants

Optimized versions

adb shell pm clear com.example.app --user 10

Clear application data for user 10.

adb shell pm clear com.example.app --force

Force clear the application data regardless of permission issues.

Troubleshooting

Common pitfalls

Error: Unable to clear data for package com.example.app.

Solution: Double-check the package name and ensure the app is installed.

Error: Illegal operation attempted.

Solution: Verify you have sufficient permissions to clear app data.

Error: User 10 has no permission to clear data.

Solution: Ensure the command is executed under the correct user context.

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.
<package>
package
The value supplied for package.

Alternative Approaches

Comparable commands in other tools

Alternative programming tools for the same job.