# android.content.res.Resources$NotFoundException: 资源 ID #0x7f0a000b 类型 #0x12 无效

- **ID:** `android/resource-not-found-in-package`
- **领域:** android
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

运行时引用了某个资源 ID，但该资源已被删除、重命名，或位于当前 APK 中不存在的配置中（例如 layout-land vs layout-port）。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Android 5.0 - 14 | active | — | — |
| AndroidX 1.0 - 1.7 | active | — | — |

## 解决方案

1. ```
   Check the resource ID by decoding it using 'adb shell dumpsys package <package> | grep resource' and ensure the resource exists in the APK by inspecting the R.txt file in the build/outputs folder.
   ```
2. ```
   Add missing resource to all required configuration folders (e.g., drawable, drawable-land, drawable-night) or use a programmatic fallback: 'if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getDrawable(R.drawable.my_drawable, theme) } else { getResources().getDrawable(R.drawable.my_drawable) }'
   ```

## 无效尝试

- **** — If the resource is missing from the APK due to a build configuration issue (e.g., missing drawable variant), a rebuild alone won't fix it. (50% 失败率)
- **** — If the device uses a specific configuration (e.g., landscape), the resource might still be missing; the resource must be present in all relevant qualifier folders or use a fallback. (50% 失败率)
