2

我正在尝试在 Android 中使用手动编译的 OpenAL 共享库。

include $(CLEAR_VARS)
LOCAL_MODULE:=openal
LOCAL_SRC_FILES:=../mylibs/libopenal.so
LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/include/AL
include $(PREBUILT_SHARED_LIBRARY)

在 mylibs 文件夹中,我有 3 个文件:

lrwxr-xr-x  21:12 libopenal.so -> libopenal.so.1
lrwxr-xr-x  21:12 libopenal.so.1 -> libopenal.so.1.13.0
-rwxr-xr-x  22:33 libopenal.so.1.13.0

一切正常,但在运行时我收到此错误:

E/AndroidRuntime(13604): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library:         link_image[1848]:  1296 could not load needed library 'libopenal.so.1' for 'libopenaltest.so'     (load_library[1120]: Library 'libopenal.so.1' not found)
E/AndroidRuntime(13604):    at java.lang.Runtime.loadLibrary(Runtime.java:370)
E/AndroidRuntime(13604):    at java.lang.System.loadLibrary(System.java:535)
E/AndroidRuntime(13604):    at com.hz.openal.OpenActivity.<clinit>(OpenActivity.java:10)
E/AndroidRuntime(13604):    ... 15 more

谁能帮我解决这个问题?

4

1 回答 1

1

像这样试试

LOCAL_MODULE := lib3rdparty-prebuilt
LOCAL_SRC_FILES := lib3rdparty.so
include $(PREBUILT_SHARED_LIBRARY)

LOCAL_SHARED_LIBRARIES += lib3rdparty-prebuilt

我认为您缺少最后一行 LOCAL_SHARED_LIBRARIES .....

而且您在加载“libopenaltest.so”库之前没有加载“libopenal.so”库。在加载依赖库之前,需要使用 System.loadLibrary() 加载所有库。

于 2012-12-03T13:28:27.753 回答