2

在我接手的项目使用的 Android::Mutex 和 Android::AudioTrack 的链接时,我收到了奇怪的未定义引用。

有没有人有任何想法?没有要包含的Android静态库吗?

共享库:* *jni.so

/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `__static_initialization_and_destruction_0':
/Users/kevin/Desktop/player2/videoplayer/LibPlayer/amadec/audio_out/android_out.cpp:29: undefined reference to `android::Mutex::Mutex()'
/Users/kevin/Desktop/player2/videoplayer/LibPlayer/amadec/audio_out/android_out.cpp:29: undefined reference to `android::Mutex::~Mutex()'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `Autolock':
/Android/source/frameworks/base/include/utils/threads.h:232: undefined reference to `android::Mutex::lock()'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `~Autolock':
/Android/source/frameworks/base/include/utils/threads.h:234: undefined reference to `android::Mutex::unlock()'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `Autolock':
/Android/source/frameworks/base/include/utils/threads.h:232: undefined reference to `android::Mutex::lock()'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `android_mute':
/Users/kevin/Desktop/player2/videoplayer/LibPlayer/amadec/audio_out/android_out.cpp:263: undefined reference to `android::AudioTrack::mute(bool)'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `~Autolock':
/Android/source/frameworks/base/include/utils/threads.h:234: undefined reference to `android::Mutex::unlock()'
/Android/source/frameworks/base/include/utils/threads.h:234: undefined reference to `android::Mutex::unlock()'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `Autolock':
/Android/source/frameworks/base/include/utils/threads.h:232: undefined reference to `android::Mutex::lock()'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `android_resume':
/Users/kevin/Desktop/player2/videoplayer/LibPlayer/amadec/audio_out/android_out.cpp:255: undefined reference to `android::AudioTrack::start()'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `~Autolock':
/Android/source/frameworks/base/include/utils/threads.h:234: undefined reference to `android::Mutex::unlock()'
/Android/source/frameworks/base/include/utils/threads.h:234: undefined reference to `android::Mutex::unlock()'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `Autolock':
/Android/source/frameworks/base/include/utils/threads.h:232: undefined reference to `android::Mutex::lock()'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `android_pause':
/Users/kevin/Desktop/player2/videoplayer/LibPlayer/amadec/audio_out/android_out.cpp:247: undefined reference to `android::AudioTrack::pause()'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `~Autolock':
/Android/source/frameworks/base/include/utils/threads.h:234: undefined reference to `android::Mutex::unlock()'
/Android/source/frameworks/base/include/utils/threads.h:234: undefined reference to `android::Mutex::unlock()'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `android_get_delay':
/Users/kevin/Desktop/player2/videoplayer/LibPlayer/amadec/audio_out/android_out.cpp:237: undefined reference to `android::AudioTrack::latency() const'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `Autolock':
/Android/source/frameworks/base/include/utils/threads.h:232: undefined reference to `android::Mutex::lock()'
/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':
/Android/source/frameworks/base/include/utils/threads.h:234: undefined reference to `android::Mutex::unlock()'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `Autolock':
/Android/source/frameworks/base/include/utils/threads.h:232: undefined reference to `android::Mutex::lock()'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `android_start':
/Users/kevin/Desktop/player2/videoplayer/LibPlayer/amadec/audio_out/android_out.cpp:197: undefined reference to `android::AudioTrack::initCheck() const'
/Users/kevin/Desktop/player2/videoplayer/LibPlayer/amadec/audio_out/android_out.cpp:198: undefined reference to `android::AudioTrack::start()'
/Users/kevin/Desktop/player2/videoplayer/LibPlayer/amadec/audio_out/android_out.cpp:201: undefined reference to `android::AudioTrack::setVolume(float, float)'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `~Autolock':
/Android/source/frameworks/base/include/utils/threads.h:234: undefined reference to `android::Mutex::unlock()'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `android_start':
/Users/kevin/Desktop/player2/videoplayer/LibPlayer/amadec/audio_out/android_out.cpp:207: undefined reference to `android::AudioTrack::~AudioTrack()'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `Autolock':
/Android/source/frameworks/base/include/utils/threads.h:232: undefined reference to `android::Mutex::lock()'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `android_init':
/Users/kevin/Desktop/player2/videoplayer/LibPlayer/amadec/audio_out/android_out.cpp:122: undefined reference to `android::AudioTrack::AudioTrack()'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `~Autolock':
/Android/source/frameworks/base/include/utils/threads.h:234: undefined reference to `android::Mutex::unlock()'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `android_init':
/Users/kevin/Desktop/player2/videoplayer/LibPlayer/amadec/audio_out/android_out.cpp:139: undefined reference to `android::AudioTrack::set(int, unsigned int, int, int, int, unsigned int, void (*)(int, void*, void*), void*, int, android::sp<android::IMemory> const&, bool, int)'
/Users/kevin/Desktop/player2/videoplayer/videoplayer/obj/local/armeabi-v7a/libamadec.a(android_out.o): In function `~sp':
/Android/source/frameworks/base/include/utils/RefBase.h:378: undefined reference to `android::RefBase::decStrong(void const*) const'
collect2: ld returned 1 exit status
4

2 回答 2

4

这也困扰着我——但我最终通过与 Bionic 的标题 ( bionic/libc/include) 链接来解决它,并且 - 重要的部分 - #define'ing HAVE_PTHREADS(即 add LOCAL_CFLAGS += HAVE_PTHREADS)。

于 2012-08-23T20:50:00.707 回答
1

好吧,这些都是一些奇怪的错误...看起来每次您从 android::Mutex 或 android::AudioTrack 库中引用某些内容时,链接器都无法找到这些函数。我只能说,由于这些库不是 android 标准库的一部分,因此请确保将它们放在构建路径中,否则祝你好运。

于 2012-06-11T19:28:16.830 回答