{
  "id": "android/install-failed-uid-changed",
  "signature": "INSTALL_FAILED_UID_CHANGED: Package com.example.app has mismatched UID on /data/data/com.example.app",
  "signature_zh": "安装失败，UID 变更：包 com.example.app 在 /data/data/com.example.app 上的 UID 不匹配",
  "regex": "INSTALL_FAILED_UID_CHANGED.*Package.*mismatched UID",
  "domain": "android",
  "category": "install_error",
  "subcategory": null,
  "root_cause": "App data directory retains a stale UID from a previous installation, causing a mismatch when reinstalling after uninstalling without clearing data.",
  "root_cause_type": "generic",
  "root_cause_zh": "应用数据目录保留了之前安装的陈旧 UID，导致在卸载后未清除数据的情况下重新安装时 UID 不匹配。",
  "versions": [
    {
      "version": "Android 8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 13",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 14",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 15",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Reinstall the app without clearing data first via adb install -r",
      "why_fails": "The -r flag preserves app data, including the stale UID, so the mismatch persists.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Manually delete the package directory using adb shell rm -rf /data/data/com.example.app",
      "why_fails": "On production devices without root, the shell lacks permissions to delete system data directories.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Change the package name in the manifest to avoid the conflict",
      "why_fails": "This requires code changes and doesn't fix the root cause, leading to a different app identity.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "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.",
      "success_rate": 0.85,
      "how": "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.",
      "condition": "",
      "sources": []
    },
    {
      "action": "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.",
      "success_rate": 0.95,
      "how": "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.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using Android Studio, go to Build > Clean Project, then Run > 'Uninstall All' from the device dropdown, then rebuild and deploy.",
      "success_rate": 0.8,
      "how": "If using Android Studio, go to Build > Clean Project, then Run > 'Uninstall All' from the device dropdown, then rebuild and deploy.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "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.",
    "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.",
    "If using Android Studio, go to Build > Clean Project, then Run > 'Uninstall All' from the device dropdown, then rebuild and deploy."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://developer.android.com/studio/command-line/adb#installingapk",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-06-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}