# Gradle task assembleDebug failed with exit code 1: NDK version mismatch. Expected (23.1.7779620) but found (25.2.9519653)

- **ID:** `flutter/gradle-ndk-version-mismatch`
- **Domain:** flutter
- **Category:** build_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The Android NDK version installed on the system does not match the version required by the Flutter project's native dependencies, causing compilation failures.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Flutter 3.22.0 | active | — | — |
| Android Gradle Plugin 8.2.0 | active | — | — |
| NDK 23.1.7779620 | active | — | — |

## Workarounds

1. **Install the required NDK version via Android Studio SDK Manager or command line: sdkmanager 'ndk;23.1.7779620'. Then update android/gradle.properties: android.ndkVersion=23.1.7779620** (85% success)
   ```
   Install the required NDK version via Android Studio SDK Manager or command line: sdkmanager 'ndk;23.1.7779620'. Then update android/gradle.properties: android.ndkVersion=23.1.7779620
   ```
2. **If you cannot install the exact version, modify the project's build.gradle to use the system NDK version and update any native dependencies that require the specific version. Example: ndkVersion = '25.2.9519653' in android/app/build.gradle, then test compatibility.** (75% success)
   ```
   If you cannot install the exact version, modify the project's build.gradle to use the system NDK version and update any native dependencies that require the specific version. Example: ndkVersion = '25.2.9519653' in android/app/build.gradle, then test compatibility.
   ```
3. **Use 'flutter config --android-ndk /path/to/correct/ndk' to point Flutter to a compatible NDK installation.** (80% success)
   ```
   Use 'flutter config --android-ndk /path/to/correct/ndk' to point Flutter to a compatible NDK installation.
   ```

## Dead Ends

- **Delete the entire .gradle directory and rebuild.** — Deleting .gradle only clears caches; the NDK version mismatch is a system-level configuration issue. (90% fail)
- **Set the NDK version in local.properties by force to the system version without adjusting dependencies.** — Forcing a different NDK version can break native library compilation if the C++ code relies on specific API levels. (70% fail)
