android install_error ai_generated true

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

ID: android/install-failed-uid-changed

Also available as: JSON · Markdown · 中文
85%Fix Rate
85%Confidence
1Evidence
2023-06-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
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

Root Cause

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

generic

中文

应用数据目录保留了之前安装的陈旧 UID,导致在卸载后未清除数据的情况下重新安装时 UID 不匹配。

Official Documentation

https://developer.android.com/studio/command-line/adb#installingapk

Workarounds

  1. 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.
    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. 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.
    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. 80% success If using Android Studio, go to Build > Clean Project, then Run > 'Uninstall All' from the device dropdown, then rebuild and deploy.
    If using Android Studio, go to Build > Clean Project, then Run > 'Uninstall All' from the device dropdown, then rebuild and deploy.

中文步骤

  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.
  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.
  3. If using Android Studio, go to Build > Clean Project, then Run > 'Uninstall All' from the device dropdown, then rebuild and deploy.

Dead Ends

Common approaches that don't work:

  1. Reinstall the app without clearing data first via adb install -r 95% fail

    The -r flag preserves app data, including the stale UID, so the mismatch persists.

  2. Manually delete the package directory using adb shell rm -rf /data/data/com.example.app 80% fail

    On production devices without root, the shell lacks permissions to delete system data directories.

  3. Change the package name in the manifest to avoid the conflict 90% fail

    This requires code changes and doesn't fix the root cause, leading to a different app identity.