Android ndk undefined reference to android::RefBase::incStrong

2.8k views Asked by At

Getting this linker error when trying to use classes defined in stagefright. I am trying to use MediaExtractor,

$ /cygdrive/d/Android/tool_set/android-ndk-r8e-windows-x86/android-ndk-r8e/ndk-
build
/cygdrive/d/Android/tool_set/android-ndk-r8e-windows-x86/android-ndk-r8e/build/c
ore/add-application.mk:128: Android NDK: WARNING: APP_PLATFORM android-14 is lar
ger than android:minSdkVersion 8 in ./AndroidManifest.xml
Compile++ thumb  : mediaextractor <= mediaextractor.cpp
SharedLibrary  : libmediaextractor.so
D:/Android/tool_set/android-ndk-r8e-windows-x86/android-ndk-r8e/toolchains/arm-l
inux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/.
./../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/mediaextra
ctor/mediaextractor/mediaextractor.o: in function Java_com_example_omxtry_MediaE
xtractorActivity_mediaExtractorCreate(_JNIEnv*, _jclass*):jni/mediaextractor/and
roid-headers-gingerbread/frameworks/base/include/utils/RefBase.h:366: error: und
efined reference to 'android::RefBase::incStrong(void const*) const'
D:/Android/tool_set/android-ndk-r8e-windows-x86/android-ndk-r8e/toolchains/arm-l
inux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/.
./../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/mediaextra
ctor/mediaextractor/mediaextractor.o: in function Java_com_example_omxtry_MediaE
xtractorActivity_mediaExtractorCreate(_JNIEnv*, _jclass*):jni/mediaextractor/and
roid-headers-gingerbread/frameworks/base/include/utils/RefBase.h:379: error: und
efined reference to 'android::RefBase::decStrong(void const*) const'
collect2: ld returned 1 exit status
m

ake: * [obj/local/armeabi/libmediaextractor.so] Error 1

My Android.mk file is

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
SRC_PATH := $(LOCAL_PATH)/../mediaextractor
TARGET_PLATFORM = android-9
LOCAL_MODULE    := mediaextractor
LOCAL_SRC_FILES := mediaextractor/mediaextractor.cpp
LOCAL_C_INCLUDES += $(LOCAL_PATH)/mediaextractor/android-headers-gingerbread/frameworks/base/include
LOCAL_C_INCLUDES += $(LOCAL_PATH)/mediaextractor/android-headers-gingerbread/system/core/include
LOCAL_LDFLAGS := -L$(LOCAL_PATH)/mediaextractor/android-headers-gingerbread/libs/ 
LOCAL_LDLIBS    += -llog -ldl
LOCAL_LDLIBS    += -landroid -lstdc++
LOCAL_LDLIBS    += -lstagefright #-lutils
LOCAL_CFLAGS    += -UNDEBUG
include $(BUILD_SHARED_LIBRARY)

How to solve this problem?

Also do i need to specify LOCAL_LDLIBS += -landroid -lstdc++ ??

0

There are 0 answers