# Invalid argument(s): Failed to load dynamic library 'libmy_native.so': dlopen failed: library not found

- **ID:** `flutter/dart-ffi-missing-library`
- **Domain:** flutter
- **Category:** module_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The native library (.so file) is not bundled with the app or not placed in the correct ABI directory.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.13.0 | active | — | — |
| 3.16.0 | active | — | — |
| 3.22.0 | active | — | — |

## Workarounds

1. **Place the .so files in the correct jniLibs directory structure (e.g., android/app/src/main/jniLibs/arm64-v8a/).** (85% success)
   ```
   Place the .so files in the correct jniLibs directory structure (e.g., android/app/src/main/jniLibs/arm64-v8a/).
   ```
2. **Use the flutter_ffi plugin's built-in bundling mechanism by declaring the library in pubspec.yaml under 'ffi_native_libraries'.** (90% success)
   ```
   Use the flutter_ffi plugin's built-in bundling mechanism by declaring the library in pubspec.yaml under 'ffi_native_libraries'.
   ```
3. **Configure Gradle to include the library by adding jniLibs sourceSets in android/app/build.gradle.** (80% success)
   ```
   Configure Gradle to include the library by adding jniLibs sourceSets in android/app/build.gradle.
   ```

## Dead Ends

- **** — Flutter's Gradle build does not automatically include libs/ unless jniLibs sourceSets are configured. (50% fail)
- **** — Android will not load the library if the ABI does not match the device's architecture. (30% fail)
- **** — Prevents extraction of native libs from APK; library file remains inaccessible at runtime. (20% fail)
