# android.view.InflateException: Binary XML file line #XX: Error inflating class androidx.constraintlayout.widget.ConstraintLayout

- **ID:** `android/layout-constraint-layout-inflation-error`
- **Domain:** android
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

The ConstraintLayout dependency is missing, version mismatch, or the XML layout contains invalid attributes that prevent inflation.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| ConstraintLayout 2.1.4 | active | — | — |
| ConstraintLayout 2.2.0 | active | — | — |

## Workarounds

1. **Ensure the ConstraintLayout dependency is in build.gradle (Module: app). Example: implementation 'androidx.constraintlayout:constraintlayout:2.1.4' and sync the project.** (90% success)
   ```
   Ensure the ConstraintLayout dependency is in build.gradle (Module: app). Example: implementation 'androidx.constraintlayout:constraintlayout:2.1.4' and sync the project.
   ```
2. **Check for version conflicts by running ./gradlew :app:dependencies and ensure no duplicate or incompatible versions of ConstraintLayout are present.** (80% success)
   ```
   Check for version conflicts by running ./gradlew :app:dependencies and ensure no duplicate or incompatible versions of ConstraintLayout are present.
   ```
3. **If using a library module, use 'api' instead of 'implementation' to propagate the dependency to the app module.** (75% success)
   ```
   If using a library module, use 'api' instead of 'implementation' to propagate the dependency to the app module.
   ```

## Dead Ends

- **** — If the version is incompatible with other libraries or the app module doesn't have the dependency, inflation fails. (70% fail)
- **** — This changes the layout behavior and may break UI design, but doesn't fix the underlying dependency issue. (50% fail)
- **** — If the dependency is missing, rebuilding won't fix the classpath issue. (85% fail)
