title: android ndk UnsatisfiedLinkError when using a prebuilt shared library
body: <p>I'm trying to create a shared library that links to another shared library.  </p>
  
  <p>Here is my main module Android.mk:</p>
  
  <pre><code>TOP_LOCAL_PATH := $(call my-dir)
  include $(call all-subdir-makefiles)
  
  LOCAL_PATH := $(TOP_LOCAL_PATH)
  
  include $(CLEAR_VARS)
  
  LOCAL_CPP_EXTENSION := cpp
  
  
  LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/ $(LOCAL_PATH)/lib/include
  LOCAL_MODULE    := SightCore-jni
  LOCAL_SRC_FILES := SightDemo.cpp SightCore-jni.cpp
  LOCAL_SHARED_LIBRARIES := SightAPI
  LOCAL_LDLIBS = -llog 
  
  include $(BUILD_SHARED_LIBRARY)
  </code></pre>
  
  <p>I also have the prebuilt shared library in ./lib directory with its own Android.mk file:</p>
  
  <pre><code>LOCAL_PATH := $(call my-dir)
  
  include $(CLEAR_VARS)
  
  LOCAL_MODULE    := SightAPI
  LOCAL_SRC_FILES := libSightAPI.so
  LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
  
  include $(PREBUILT_SHARED_LIBRARY)
  </code></pre>
  
  <p>The SightCore-jni.cpp source file is the jni interface to the shared library and is loaded using the command </p>
  
  <pre><code>System.loadLibrary("SightCore-jni");  
  </code></pre>
  
  <p>During the ndk-build process I get <strong>no compilation or linkage</strong> errors. 
  When I try to run the application and access one of the native methods I get the UnsatsfiedLinkError.
  I noticed that if disable the references to the SightAPI in my jni code and put a typo to the LOCAL_STATIC_LIBRARIES := SightAPI line, The build is successful and there is no <strong>UnsatisfiedLinkError</strong>.<br>
  This mean that the jni code I have is good (I'm actually sure it is ok...)</p>
  
  <p><strong>So the observation is as follows:</strong><br>
  If I compile the shared library <strong>with the prebuilt</strong> shared library I get a <strong>corrupted</strong> .so file.  </p>
  
  <p>If I compile the same ndk project <strong>without linking to the prebuilt</strong> shared library there is <strong>no problem</strong> loading the shared library from the java side.    </p>
  
  <p>Please help me out if you can.</p>
  
  <p>Thanks in advance, </p>
  
  <p>Ita</p>