Clear an app's data
android_clear_dataWipe an app's data and cache while keeping it installed, resetting it to a first-run state without uninstalling. Use to test onboarding flows or clear a corrupt database.
Instructions
Wipe an app's data and cache while leaving it installed — the equivalent of "Clear storage" in system settings.
Use this to get back to a first-run state without uninstalling. It is less disruptive than android_uninstall (the app and its install stay put) but it still destroys everything the app has stored: databases, preferences, cached files, and any signed-in session.
Args:
package_name (string, optional): application id to clear
project_path (string, optional): Gradle root; the package is resolved from it when package_name is omitted
module (string): module to read the package from (default: 'app')
serial (string, optional): target device
Returns: { "cleared": boolean, "packageName": string, "serial": string }
Examples:
Use when: testing onboarding or a first-run migration repeatedly
Use when: a corrupt local database is masking the bug you are chasing
Don't use when: you need the app gone entirely (use android_uninstall)
Error Handling:
Reports when the package is not installed
The app is force-stopped as a side effect; relaunch it with android_launch
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "android_clear_data"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| module | No | Gradle module that produces the APK. Almost always 'app'. | app |
| serial | No | Device serial from android_list_devices. Optional when exactly one device is connected; required when several are. | |
| package_name | No | Application id whose data to clear. | |
| project_path | No | Gradle root to resolve the package from. |