# android.view.InflateException: Binary XML file line #XX: 错误膨胀类 <unknown>

- **ID:** `android/layout-inflater-crash-bad-parameter`
- **领域:** android
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

布局 XML 文件包含无效属性、缺少自定义视图或不兼容的资源引用，导致无法膨胀。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Android 10 (API 29) | active | — | — |
| Android 11 (API 30) | active | — | — |
| Android 12 (API 31) | active | — | — |
| Android 13 (API 33) | active | — | — |

## 解决方案

1. ```
   检查错误指示行号的布局 XML 文件，查找属性名称拼写错误、缺少命名空间声明（如 xmlns:app）或不正确的自定义视图类名。例如：如果使用 appcompat，将 'android:backgroundTint' 替换为 'app:backgroundTint'。
   ```
2. ```
   确保所有自定义视图在 XML 中使用完整限定类名声明（例如 com.example.MyCustomView 而不是 MyCustomView）。
   ```
3. ```
   如果使用了库中的自定义视图，请验证该库是否已作为依赖项添加到 build.gradle 中，并且该视图不是条件加载的。
   ```

## 无效尝试

- **** — The error is in the code, not runtime cache; clearing cache doesn't fix invalid XML. (90% 失败率)
- **** — Reinstallation doesn't change the source code; the same invalid XML will be inflated again. (95% 失败率)
