我有以下Android.mk ...問題在Android中加載依賴.SO NDK
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := Box2D-local
LOCAL_SRC_FILES := $(LOCAL_PATH)/../Box2D/libs/$(TARGET_ARCH_ABI)/libbox2D.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := openbox
LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. $(LOCAL_PATH)
NDK_OUT :=../../
LOCAL_SRC_FILES := \
$(subst $(LOCAL_PATH)/,, \
$(wildcard $(LOCAL_PATH)/*.cpp) \
$(wildcard $(LOCAL_PATH)/Collision/Shapes/*.cpp))
LOCAL_LDLIBS := -lm -llog -ldl -lGLESv1_CM
LOCAL_SHARED_LIBRARIES := Box2D-local
include $(BUILD_SHARED_LIBRARY)
一切編譯罰款,但是當我跑我看到應用程序....
d/dalvikvm(14851):試圖加載LIB /data/app-lib/com.lmdig.android.tutorial.oglbox2dbasics-1/libopenbox.so 0x40ce7138
E/dalvikvm(14851):的dlopen(「/數據/ app-lib/com.lmdig.android.tutorial.oglbox2dbasics-1/libopenbox.so「)失敗:無法加載庫:soinfo_link_image(linker.cpp:1635):無法加載「libopenbox.so」所需的庫「libbox2D.so」;造成load_library(linker.cpp:745):庫 「libbox2D.so」 找不到
但是,當我LS上的/data/app-lib/com.lmdig.android.tutorial.oglbox2dbasics-1/文件夾在設備上我看到...
[email protected]:/ # ls /data/app-lib/com.lmdig.android.tutorial.oglbox2dbasics-1/
libbox2D.so
libopenbox.so
我的LOCAL_SRC_FILES是錯的還是什麼?
正確。 Android加載程序不會在** lib文件夾中查找** so **文件,這些文件可以解析缺少的引用,但僅在'/ system/lib'中。 –
@Jackie因此,您究竟如何解決此問題?在您的NativeActivity類中添加對System.loadLibrary(「box2D」)的調用?以某種方式修改你的Android.mk? – OldPeculier