title: Android NDK building - Include LOCAL_SHARED_LIBRARIES?
body: <p>I'm having problems building a project under the Android NDK. Most likely its due to the proper shared / static libraries not being included. The ones as -lsomeLib I added, but the ones as LOCAL_SHARED_LIBRARIES are not being included it seems...</p>
  
  <p>My Android.mk contains the following </p>
  
  <p>LOCAL_SHARED_LIBRARIES += libutils libmedia libz libbinder </p>
  
  <ol>
  <li>Where does ndk-build actually look for these libraries?</li>
  <li>If I don't include the -lutils -lmedia -lz -lbinder, I am not able to even get to the linker error. I have a feeling including just -LsomeDir and -lsomeLib is not the correct way to add them. </li>
  </ol>
  
  <p>Here is the complete Android.mk.</p>
  
  <pre><code>LOCAL_PATH := /Users/kevin/Desktop/player2/videoplayer/videoplayer/jni
  LIBPLAYER_PATH := $(LOCAL_PATH)/../../LibPlayer
  
  include $(CLEAR_VARS)
  
  $(warning Android make file: $(LOCAL_PATH)/Android.mk)
  $(warning Android sysroot: $(SYSROOT))
  $(warning Additional LD_LIBS: $(LOCAL_PATH)/lib)
  
  ifeq ($(BUILD_ID),MID)
          LOCAL_CFLAGS += -DENABLE_FREE_SCALE
  endif
  
  LOCAL_MODULE    := libamplayerjni
  LOCAL_SRC_FILES := com_farcore_playerservice_AmPlayer.c sys_conf.c
  LOCAL_ARM_MODE := arm
  LOCAL_C_INCLUDES := $(LIBPLAYER_PATH)/amplayer/player/include \
      $(LIBPLAYER_PATH)/amplayer/control/include \
      $(LIBPLAYER_PATH)/amcodec/include \
      $(LIBPLAYER_PATH)/amffmpeg \
      $(JNI_H_INCLUDE) \
      /Android/ndk/build/tools/android-9-toolchain/sysroot/usr/include \
      /Android/ndk/build/platforms/android-9/arch-arm/usr/include \
      /Android/source_2.3/system/core/include \
      /Android/source_2.3/frameworks/base/include
  
  LOCAL_LDLIBS := -L/Users/kevin/Desktop/player2/videoplayer/videoplayer/jni/lib -L$(SYSROOT)/usr/lib -llog -lz -lm -ldl **-lmedia -lstagefright -lutils -lbinder -lgcc -landroid -lc -lstdc++ -lthread_db**
  
  **LOCAL_STATIC_LIBRARIES := libamplayer libamcodec libavformat libavcodec libavutil libamadec**
  LOCAL_SHARED_LIBRARIES += libutils libmedia libz libbinder 
  
  LOCAL_PRELINK_MODULE := false
  
  include $(BUILD_SHARED_LIBRARY)
  </code></pre>
  
  <p>One of many errors related specifically to those libraries (ie libmedia.so).</p>
  
  <pre><code>/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `android_uninit':
  /Users/kevin/Desktop/player2/videoplayer/LibPlayer/amadec/audio_out/android_out.cpp:220: undefined reference to `android::AudioTrack::stop()'
  /Users/kevin/Desktop/player2/videoplayer/LibPlayer/amadec/audio_out/android_out.cpp:228: undefined reference to `android::AudioTrack::~AudioTrack()'
  /Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `~Autolock':
  </code></pre>