# Invalid argument(s): Could not load native library: /data/app/.../lib/arm64/libflutter.so: incompatible ABI version

- **ID:** `flutter/incompatible-abi-version`
- **Domain:** flutter
- **Category:** build_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The Flutter engine native library (libflutter.so) was compiled for a different Android ABI than the device's CPU architecture, often due to building with an incorrect target platform or using a mismatched NDK version.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Flutter 3.16.0 | active | — | — |
| Flutter 3.22.0 | active | — | — |
| Android NDK r25c | active | — | — |

## Workarounds

1. **Run 'flutter clean' and rebuild with the correct target platform. For ARM64 devices, use 'flutter build apk --target-platform android-arm64'. Example:
  flutter clean
  flutter build apk --target-platform android-arm64 --release** (85% success)
   ```
   Run 'flutter clean' and rebuild with the correct target platform. For ARM64 devices, use 'flutter build apk --target-platform android-arm64'. Example:
  flutter clean
  flutter build apk --target-platform android-arm64 --release
   ```
2. **Update the Android NDK version to match Flutter's requirements. In android/app/build.gradle, set:
  ndkVersion "25.1.8937393"
Then run 'flutter clean' and rebuild.** (80% success)
   ```
   Update the Android NDK version to match Flutter's requirements. In android/app/build.gradle, set:
  ndkVersion "25.1.8937393"
Then run 'flutter clean' and rebuild.
   ```
3. **Enable ABI splitting in android/app/build.gradle to generate separate APKs for each ABI:
  android {
    splits {
      abi {
        enable true
        reset()
        include 'arm64-v8a', 'armeabi-v7a', 'x86_64'
      }
    }
  }** (75% success)
   ```
   Enable ABI splitting in android/app/build.gradle to generate separate APKs for each ABI:
  android {
    splits {
      abi {
        enable true
        reset()
        include 'arm64-v8a', 'armeabi-v7a', 'x86_64'
      }
    }
  }
   ```

## Dead Ends

- **Set 'android:extractNativeLibs="true"' in AndroidManifest.xml** — This flag controls APK packaging but does not fix the ABI mismatch; the library still has the wrong ABI. (80% fail)
- **Add all ABIs to the build.gradle abiFilters** — Including all ABIs increases APK size but doesn't resolve an incompatible ABI; the device still gets the wrong library if the build targets a different ABI. (60% fail)
- **Delete the build folder and rebuild without cleaning** — Without cleaning, the stale library persists; 'flutter clean' is required to remove the cached native libraries. (70% fail)
