android install_error ai_generated true

安装失败,UID 变更:包 com.example.app 在 /data/data/com.example.app 上的 UID 不匹配

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

ID: android/install-failed-uid-changed

其他格式: JSON · Markdown 中文 · English
85%修复率
85%置信度
1证据数
2023-06-15首次发现

版本兼容性

版本状态引入弃用备注
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

根因分析

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

English

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

generic

官方文档

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

解决方案

  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.

无效尝试

常见但无效的做法:

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

    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% 失败

    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% 失败

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