title: Eclipse Error "java.lang.unsatisfiedlinkerror Native method not found"
body: <p>I am developing Android project thru Eclipse Luna + APK19 + ndk_r10b.
  I try to pick up NDK development flow thru some online tutorial. 
  <a href="http://www.decom.ufop.br/imobilis/?p=1832" rel="nofollow">http://www.decom.ufop.br/imobilis/?p=1832</a></p>
  
  <p>I able to compile in Eclipse without error, but when I run to virtual device, it pop-up the Error "java.lang.unsatisfiedlinkerror Native method not found", then the virtual device show "Unexpected Stop". I try to export as .apk, it fail on hardware as well. I try to changes different tutorial, but same problem show up.</p>
  
  <p>Can help to show me some light on how to debug? 
  I have stuck at here more than a week, very appreciate the help. 
  Thanks in advanced.</p>
  
  <pre class="lang-none prettyprint-override"><code>09-30 03:07:15.668: I/Process(1723): Sending signal. PID: 1723 SIG: 9
  09-30 03:29:02.248: D/dalvikvm(1770): Trying to load lib /data/app-lib/com.test.ndkexample-
  2/libNativeFunctionality.so 0xb4d45338
  09-30 03:29:02.248: D/dalvikvm(1770): Added shared lib /data/app-lib/com.test.ndkexample 2/libNativeFunctionality.so 0xb4d45338
  09-30 03:29:02.248: D/dalvikvm(1770): No JNI_OnLoad found in /data/app-lib/com.test.ndkexample ibNativeFunctionality.so 0xb4d45338, skipping init
  09-30 03:29:02.568: W/dalvikvm(1770): No implementation found for native Lcom/test/ndkexample/MainActivity;.HelloWorldNDK:()V
  09-30 03:29:02.568: D/AndroidRuntime(1770): Shutting down VM
  09-30 03:29:02.568: W/dalvikvm(1770): threadid=1: thread exiting with uncaught exception (group=0xb4a94ba8)
  09-30 03:29:02.578: E/AndroidRuntime(1770): FATAL EXCEPTION: main
  09-30 03:29:02.578: E/AndroidRuntime(1770): Process: com.test.ndkexample, PID: 1770
  09-30 03:29:02.578: E/AndroidRuntime(1770): java.lang.UnsatisfiedLinkError: Native method not found: com.test.ndkexample.MainActivity.HelloWorldNDK:()V
  09-30 03:29:02.578: E/AndroidRuntime(1770):     at com.test.ndkexample.MainActivity.onStart(MainActivity.java:34)
  09-30 03:29:02.578: E/AndroidRuntime(1770):     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
  09-30 03:29:02.578: E/AndroidRuntime(1770):     at android.app.Activity.performStart(Activity.java:5241)
  09-30 03:29:02.578: E/AndroidRuntime(1770):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2168)
  09-30 03:29:02.578: E/AndroidRuntime(1770):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
  09-30 03:29:02.578: E/AndroidRuntime(1770):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
  09-30 03:29:02.578: E/AndroidRuntime(1770):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
  09-30 03:29:02.578: E/AndroidRuntime(1770):     at android.os.Handler.dispatchMessage(Handler.java:102)
  09-30 03:29:02.578: E/AndroidRuntime(1770):     at android.os.Looper.loop(Looper.java:136)
  09-30 03:29:02.578: E/AndroidRuntime(1770):     at android.app.ActivityThread.main(ActivityThread.java:5017)
  09-30 03:29:02.578: E/AndroidRuntime(1770):     at java.lang.reflect.Method.invokeNative(Native Method)
  09-30 03:29:02.578: E/AndroidRuntime(1770):     at java.lang.reflect.Method.invoke(Method.java:515)
  09-30 03:29:02.578: E/AndroidRuntime(1770):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
  09-30 03:29:02.578: E/AndroidRuntime(1770):     at     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
  09-30 03:29:02.578: E/AndroidRuntime(1770):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>MainActivity.java</p>
  
  <pre class="lang-java prettyprint-override"><code>package com.test.ndkexample;
  import android.support.v7.app.ActionBarActivity;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.widget.TextView;
  
  public class MainActivity extends ActionBarActivity {
  
      static {
          System.loadLibrary("NativeFunctionality");
          }
  
      TextView ndkTextView;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {    
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
      }
  
      @Override
      protected void onStart() {
      super.onStart();
      HelloWorldNDK();
      ndkTextView = (TextView)findViewById(R.id.ndkText);
      String ndkString = GetAnswer();
      ndkTextView.setText(ndkString);
      }
  
  
      public native void HelloWorldNDK();
      public native String GetAnswer();
      }  
  </code></pre>
  
  <p>NativeFunctionality.cpp</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;jni.h&gt;
  #include "NativeFunctionality.h"
  #include &lt;android/log.h&gt;
  #include &lt;pthread.h&gt;
  #include &lt;unistd.h&gt;
  #define LOG_TAG "NDKTest"
  
  JNIEXPORT void JNICALL Java_com_test_NDKExample_MainActivity_HelloWorldNDK
  (JNIEnv *env, jobject obj)
  {
  __android_log_print(ANDROID_LOG_INFO,LOG_TAG,"Native function called!");
  
  return;
  
  }
  
  JNIEXPORT jstring JNICALL Java_com_test_NDKExample_MainActivity_GetAnswer
  (JNIEnv *env, jobject obj)
  
  {
  
      return (env-&gt;NewStringUTF("String returned from native environment!"));
  
  }
  </code></pre>
  
  <p>NativeFunctionality.h</p>
  
  <pre class="lang-cpp prettyprint-override"><code>/* DO NOT EDIT THIS FILE - it is machine generated */
  #include &lt;jni.h&gt;
  /* Header for class com_test_ndkexample_MainActivity */
  
  #ifndef _Included_com_test_ndkexample_MainActivity
  #define _Included_com_test_ndkexample_MainActivity
   #ifdef __cplusplus
  
  extern "C" {
  
  #endif
  /*
   * Class:     com_test_ndkexample_MainActivity
   * Method:    HelloWorldNDK
   * Signature: ()V
       */
  JNIEXPORT void JNICALL Java_com_test_ndkexample_MainActivity_HelloWorldNDK
    (JNIEnv *, jobject);
  
   /*
   * Class:     com_test_ndkexample_MainActivity
   * Method:    GetAnswer
   * Signature: ()Ljava/lang/String;
   */
  JNIEXPORT jstring JNICALL Java_com_test_ndkexample_MainActivity_GetAnswer
    (JNIEnv *, jobject);
  
  #ifdef __cplusplus
  
  }
  #endif
  #endif
  </code></pre>
  
  <p>Android.mk</p>
  
  <pre class="lang-none prettyprint-override"><code>LOCAL_PATH := $(call my-dir)
  
  include $(CLEAR_VARS)
  
  LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
  LOCAL_MODULE    := NativeFunctionality
  LOCAL_SRC_FILES := NativeFunctionality.cpp
  
  include $(BUILD_SHARED_LIBRARY)
  </code></pre>