# INSTALL_FAILED_UID_CHANGED: Package com.example.app has mismatched UID on /data/data/com.example.app

- **ID:** `android/install-failed-uid-changed`
- **Domain:** android
- **Category:** install_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

App data directory retains a stale UID from a previous installation, causing a mismatch when reinstalling after uninstalling without clearing data.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Android 8.0 | active | — | — |
| Android 9 | active | — | — |
| Android 10 | active | — | — |
| Android 11 | active | — | — |
| Android 12 | active | — | — |
| Android 13 | active | — | — |
| Android 14 | active | — | — |
| Android 15 | active | — | — |

## Workarounds

1. **Uninstall the app completely with adb uninstall com.example.app, then reinstall via adb install path/to/app.apk. This removes the stale data directory.** (85% success)
   ```
   Uninstall the app completely with adb uninstall com.example.app, then reinstall via adb install path/to/app.apk. This removes the stale data directory.
   ```
2. **On a rooted device, run adb shell and execute: su -c 'rm -rf /data/data/com.example.app' to force-delete the directory, then reinstall.** (95% success)
   ```
   On a rooted device, run adb shell and execute: su -c 'rm -rf /data/data/com.example.app' to force-delete the directory, then reinstall.
   ```
3. **If using Android Studio, go to Build > Clean Project, then Run > 'Uninstall All' from the device dropdown, then rebuild and deploy.** (80% success)
   ```
   If using Android Studio, go to Build > Clean Project, then Run > 'Uninstall All' from the device dropdown, then rebuild and deploy.
   ```

## Dead Ends

- **Reinstall the app without clearing data first via adb install -r** — The -r flag preserves app data, including the stale UID, so the mismatch persists. (95% fail)
- **Manually delete the package directory using adb shell rm -rf /data/data/com.example.app** — On production devices without root, the shell lacks permissions to delete system data directories. (80% fail)
- **Change the package name in the manifest to avoid the conflict** — This requires code changes and doesn't fix the root cause, leading to a different app identity. (90% fail)
