0

我有以下代码...

gl_game.cpp

#include <camera/Camera.h>
....
using namespace android;
LOGI("Number of cameras are... %d", Camera::getNumberOfCameras());

和Android.mk ...

LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../AOSP/frameworks/av/include $(LOCAL_PATH)/../../AOSP/frameworks/native/include $(LOCAL_PATH)/../../AOSP/system/core/include $(LOCAL_PATH)/../../AOSP/hardware/libhardware/include

当我尝试编译时,我看到一个链接器错误......

error: undefined reference to 'android::Camera::getNumberOfCameras()'

我假设这是因为我从未将包含 Camera.cpp 的 .so 添加到我的 LOCAL_LDLIBS 但我找不到要添加到链接器的正确 .so 文件。有人知道怎么做吗?

4

1 回答 1

0

This is what I did, I think the problem here is that the .so file implementation is Manufacturer specific. Because I am just testing and haven't made it that far yet I used a rooted emulator to grab the .so off of the emulator device itself...

adb pull /system/lib/libcamera_client.so ../project/jni/lib/

Then added the following to my Android.mk....

include $(CLEAR_VARS)
LOCAL_MODULE := libcam
LOCAL_SRC_FILES := lib/libcamera_client.so
include $(PREBUILT_SHARED_LIBRARY)
...
LOCAL_SHARED_LIBRARIES := libcam

now I see...

I/libgl2jni( 843): Number of cameras are... 0

Which is what I would expect from an emulator...

Same file also worked on my ASUS tablet...

I/libgl2jni( 8175): Number of cameras are... 2

于 2013-07-24T15:46:32.867 回答