title: Android NDK - Including prebuilt static libraries gives undefined reference errors
body: <p>I am trying to build a shared library using a prebuilt static library. For some reason, building always fails giving <code>undefined reference</code> errors. If I add <code>LOCAL_ALLOW_UNDEFINED_SYMBOLS := true</code>, building succeeds but the shared library is only a few kilobytes while the static library is about 3 megabytes... So it seems something went wrong in linking the static library. I have no idea what it could be. I am only using C++ code.</p>
  
  <p>Android.mk:</p>
  
  <pre><code>LOCAL_PATH := $(call my-dir)
  
  include $(CLEAR_VARS)
  
  LOCAL_MODULE    := kes
  LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
  LOCAL_SRC_FILES := libkes.a
  
  include $(PREBUILT_STATIC_LIBRARY)
  
  include $(CLEAR_VARS)
  
  LOCAL_MODULE    := PortaKES
  LOCAL_SRC_FILES := PortaKES.cpp
  LOCAL_STATIC_LIBARIES := kes
  
  include $(BUILD_SHARED_LIBRARY)
  </code></pre>
  
  <p>Application.mk:</p>
  
  <pre><code>APP_ABI := all
  APP_STL := stlport_static
  </code></pre>
  
  <p>JNI directory structure:</p>
  
  <p><img src="https://s18.postimg.org/fy36mdks9/jnidir.png" alt="JNI folder structure"></p>
  
  <p>Output:</p>
  
  <pre><code>./obj/local/arm64-v8a/objs/PortaKES/PortaKES.o: In function `Java_com_kurzweil_portakes_KESFile_createPOLEFile':
  C:\Users\niels.mylle\Documents\Kurzweil Mobile Android\PortaKES/jni/PortaKES.cpp:18: undefined reference to `CPoleFile::CPoleFile(char const*, bool, bool, CEncrypter*)'
  ./obj/local/arm64-v8a/objs/PortaKES/PortaKES.o: In function `Java_com_kurzweil_portakes_KESFile_createKSection':
  C:\Users\niels.mylle\Documents\Kurzweil Mobile Android\PortaKES/jni/PortaKES.cpp:33: undefined reference to `CKSection::CKSection(char const*, CPoleFile*, CPoleLeaf*)'
  ./obj/local/arm64-v8a/objs/PortaKES/PortaKES.o: In function `Java_com_kurzweil_portakes_POLEFile_destroy':
  C:\Users\niels.mylle\Documents\Kurzweil Mobile Android\PortaKES/jni/PortaKES.cpp:48: undefined reference to `CPoleFile::~CPoleFile()'
  ./obj/local/arm64-v8a/objs/PortaKES/PortaKES.o: In function `Java_com_kurzweil_portakes_POLEFile_exists':
  C:\Users\niels.mylle\Documents\Kurzweil Mobile Android\PortaKES/jni/PortaKES.cpp:100: undefined reference to `CPoleFile::exists(char const*)'
  collect2.exe: error: ld returned 1 exit status
  make.exe: *** [obj/local/arm64-v8a/libPortaKES.so] Error 1
  </code></pre>