NDK: Native method not found <p>I'm using Android NDK for the first time. What I want is to get a string from a native C++ method and use it as text in a textview. I have no idea where is the problem..</p> <p><strong>My code</strong></p> <p>Java: package: package com.example.nativetest;</p> <pre><code>@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); init(); this.textView.setText(stringFromJNI()); } public native String stringFromJNI(); static { System.loadLibrary("CascadeClassifier"); } </code></pre> <p>C++:</p> <pre><code>#include &lt;string.h&gt; #include &lt;jni.h&gt; extern "C" { JNIEXPORT jstring JNICALL Java_com_example_nativetest_MainActivity_stringFromJNI (JNIEnv *env, jobject obj) { return env-&gt;NewStringUTF("Hello from C++ over JNI!"); } } </code></pre> <p><strong>LogCat</strong></p> <pre><code>11-24 22:41:58.646: E/AndroidRuntime(12950): FATAL EXCEPTION: main 11-24 22:41:58.646: E/AndroidRuntime(12950): java.lang.UnsatisfiedLinkError: Native method not found: com.example.nativetest.MainActivity.stringFromJNI:()Ljava/lang/String; 11-24 22:41:58.646: E/AndroidRuntime(12950): at com.example.nativetest.MainActivity.stringFromJNI(Native Method) 11-24 22:41:58.646: E/AndroidRuntime(12950): at com.example.nativetest.MainActivity.onCreate(MainActivity.java:31) 11-24 22:41:58.646: E/AndroidRuntime(12950): at android.app.Activity.performCreate(Activity.java:5133) 11-24 22:41:58.646: E/AndroidRuntime(12950): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 11-24 22:41:58.646: E/AndroidRuntime(12950): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2225) 11-24 22:41:58.646: E/AndroidRuntime(12950): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2311) 11-24 22:41:58.646: E/AndroidRuntime(12950): at android.app.ActivityThread.access$600(ActivityThread.java:149) 11-24 22:41:58.646: E/AndroidRuntime(12950): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293) 11-24 22:41:58.646: E/AndroidRuntime(12950): at android.os.Handler.dispatchMessage(Handler.java:99) 11-24 22:41:58.646: E/AndroidRuntime(12950): at android.os.Looper.loop(Looper.java:137) 11-24 22:41:58.646: E/AndroidRuntime(12950): at android.app.ActivityThread.main(ActivityThread.java:5214) 11-24 22:41:58.646: E/AndroidRuntime(12950): at java.lang.reflect.Method.invokeNative(Native Method) 11-24 22:41:58.646: E/AndroidRuntime(12950): at java.lang.reflect.Method.invoke(Method.java:525) 11-24 22:41:58.646: E/AndroidRuntime(12950): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739) 11-24 22:41:58.646: E/AndroidRuntime(12950): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555) 11-24 22:41:58.646: E/AndroidRuntime(12950): at dalvik.system.NativeStart.main(Native Method) </code></pre>