{
  "id": "flutter/dart-ffi-library-not-found",
  "signature": "ArgumentError: Invalid argument(s): Failed to load dynamic library 'libnative.so': dlopen failed: library \"libnative.so\" not found",
  "signature_zh": "ArgumentError：无效参数：无法加载动态库 'libnative.so'：dlopen 失败：未找到库 \"libnative.so\"",
  "regex": "Failed to load dynamic library '[\\w.]+\\.(so|dylib|dll)': dlopen failed: library \"[\\w.]+\\.(so|dylib|dll)\" not found",
  "domain": "flutter",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "A Dart FFI binding references a native shared library that is not bundled with the app or not placed in the correct directory for the target platform (Android jniLibs, iOS Frameworks, or Linux/MacOS library paths).",
  "root_cause_type": "generic",
  "root_cause_zh": "Dart FFI 绑定引用的原生共享库未随应用打包，或未放置在目标平台的正确目录中（Android jniLibs、iOS Frameworks 或 Linux/MacOS 库路径）。",
  "versions": [
    {
      "version": "Flutter 3.7",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Dart 3.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android 12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "iOS 15",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Linux",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Assets are not loaded as shared libraries; FFI requires the library to be in the system library path or bundled as a native dependency.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "FFI resolves library paths from the system loader, not the Dart script's location; relative paths are platform-dependent and often fail.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "On mobile platforms (Android/iOS), environment variables are not accessible to the app process; this only works on desktop.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Place the shared library in the correct platform-specific directory: android/app/src/main/jniLibs/<abi>/ for Android, or use a Flutter plugin with native code.",
      "success_rate": 0.85,
      "how": "Place the shared library in the correct platform-specific directory: android/app/src/main/jniLibs/<abi>/ for Android, or use a Flutter plugin with native code.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use the ffi package's DynamicLibrary.process() to load symbols from the main process if the library is linked at compile time.",
      "success_rate": 0.7,
      "how": "Use the ffi package's DynamicLibrary.process() to load symbols from the main process if the library is linked at compile time.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Place the shared library in the correct platform-specific directory: android/app/src/main/jniLibs/<abi>/ for Android, or use a Flutter plugin with native code.",
    "Use the ffi package's DynamicLibrary.process() to load symbols from the main process if the library is linked at compile time."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://dart.dev/guides/libraries/c-interop",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2023-05-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}