{
  "id": "android/ndk-jni-method-not-found",
  "signature": "java.lang.UnsatisfiedLinkError: No implementation found for java.lang.String com.example.MyClass.nativeGetString() (tried Java_com_example_MyClass_nativeGetString and Java_com_example_MyClass_nativeGetString__)",
  "signature_zh": "java.lang.UnsatisfiedLinkError: 未找到 java.lang.String com.example.MyClass.nativeGetString() 的实现（尝试了 Java_com_example_MyClass_nativeGetString 和 Java_com_example_MyClass_nativeGetString__）",
  "regex": "java\\.lang\\.UnsatisfiedLinkError: No implementation found for .* \\(tried .*\\)",
  "domain": "android",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "JNI native method signature mismatch: the C/C++ function name does not match the expected mangled name from Java, or the native library is not loaded correctly.",
  "root_cause_type": "generic",
  "root_cause_zh": "JNI 本地方法签名不匹配：C/C++ 函数名与 Java 期望的修饰名不匹配，或本地库未正确加载。",
  "versions": [
    {
      "version": "NDK r23 - r26",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "CMake 3.22 - 3.28",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android Gradle Plugin 7.0 - 8.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "If the library is compiled only for arm64-v8a but the device is armeabi-v7a, the native method won't be found; the ABI must match.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The JNI naming convention requires exact match; any renaming breaks the linkage.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Verify the JNI method name by running 'javac -h . MyClass.java' to generate the correct header, then update the C/C++ function signature accordingly. Example: 'JNIEXPORT jstring JNICALL Java_com_example_MyClass_nativeGetString(JNIEnv *env, jobject thiz)'",
      "success_rate": 0.9,
      "how": "Verify the JNI method name by running 'javac -h . MyClass.java' to generate the correct header, then update the C/C++ function signature accordingly. Example: 'JNIEXPORT jstring JNICALL Java_com_example_MyClass_nativeGetString(JNIEnv *env, jobject thiz)'",
      "condition": "",
      "sources": []
    },
    {
      "action": "Ensure the native library is loaded in a static block: 'static { System.loadLibrary(\"mylib\"); }' and check that the library name matches the .so file (e.g., libmylib.so).",
      "success_rate": 0.8,
      "how": "Ensure the native library is loaded in a static block: 'static { System.loadLibrary(\"mylib\"); }' and check that the library name matches the .so file (e.g., libmylib.so).",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Verify the JNI method name by running 'javac -h . MyClass.java' to generate the correct header, then update the C/C++ function signature accordingly. Example: 'JNIEXPORT jstring JNICALL Java_com_example_MyClass_nativeGetString(JNIEnv *env, jobject thiz)'",
    "Ensure the native library is loaded in a static block: 'static { System.loadLibrary(\"mylib\"); }' and check that the library name matches the .so file (e.g., libmylib.so)."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://developer.android.com/ndk/guides/other_build_systems#jni",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-05-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}