# 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__)

- **ID:** `android/ndk-jni-method-not-found`
- **Domain:** android
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## 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.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| NDK r23 - r26 | active | — | — |
| CMake 3.22 - 3.28 | active | — | — |
| Android Gradle Plugin 7.0 - 8.2 | active | — | — |

## Workarounds

1. **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)'** (90% success)
   ```
   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)'
   ```
2. **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).** (80% success)
   ```
   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).
   ```

## Dead Ends

- **** — 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. (50% fail)
- **** — The JNI naming convention requires exact match; any renaming breaks the linkage. (50% fail)
