# Invalid argument(s): 加载动态库 'libmy_native.so' 失败：dlopen 失败：找不到库

- **ID:** `flutter/dart-ffi-missing-library`
- **领域:** flutter
- **类别:** module_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

本机库（.so 文件）未与应用捆绑或未放置在正确的 ABI 目录中。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.13.0 | active | — | — |
| 3.16.0 | active | — | — |
| 3.22.0 | active | — | — |

## 解决方案

1. ```
   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'.
   ```
3. ```
   Configure Gradle to include the library by adding jniLibs sourceSets in android/app/build.gradle.
   ```

## 无效尝试

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