title: Android NDK / JNI - undefined reference to function defined in custom header file
body: <p>Using JNI, I am trying to write a native C++ method for the Android NDK that makes a call to a C function defined in a custom header file.  However, I am getting an undefined reference error for my C function call.</p>
  
  <p>Here is my C++ code that makes a call to the C function and returns its result to Java as a jstring:</p>
  
  <pre><code>#include &lt;jni.h&gt;
  
  #include "gesture_detector.h"
  
  JNIEXPORT jstring JNICALL Java_com_example_bmtitest_JavaAbstractionLayer_callGestureAnalysis(JNIEnv *env, jobject obj, jfloat previousX, jfloat previousY, jfloat currentX, jfloat currentY) {
      return env-&gt;NewStringUTF(gestureAnalysis(previousX, previousY, currentX, currentY));
  }
  </code></pre>
  
  <p>Here is my C function:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  #include "gesture_detector.h"
  
  //implemented from gesture_detector.h
  const char* gestureAnalysis(float previousX, float previousY, float currentX, float currentY)
  {
      float xOffset = currentX - previousX;
      float yOffset = currentY - previousY;
  
      if(xOffset == 0 &amp;&amp; yOffset == 0)
      {
          return "TAP";
      }
      return "0";
  }
  </code></pre>
  
  <p>Here is my Android.mk code:</p>
  
  <pre><code>LOCAL_PATH := $(call my-dir)
  
  include $(CLEAR_VARS)
  
  LOCAL_MODULE    := gestureDetector
  LOCAL_SRC_FILES := gestureDetector.c NativeAbstractionLayer.cpp
  LOCAL_LDLIBS    := -landroid
  
  include $(BUILD_SHARED_LIBRARY)
  </code></pre>
  
  <p>Apparently, it seems the function definition defined in the custom header file (<code>gesture_detector.h</code>) isn't being found.  I think it may be a problem in my Android.mk file.</p>
  
  <p>Could anyone tell me what am I doing wrong here?</p>