2

尝试使用 stagefright 中定义的类时出现此链接器错误。我正在尝试使用 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] 错误 1

我的 Android.mk 文件是

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)

如何解决这个问题呢?

我还需要指定LOCAL_LDLIBS += -landroid -lstdc++吗??

4

0 回答 0