KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've built the Assimp library as a shared library. I've included it in my Android ndk project and it builds fine but when I load it I get the following error: Unable to load native library: My-Native-Activity. (Perhaps I should add that my activity works fine when the library is not included and that I've checked the apk and on the device; the library is being added to the libs folder and installed on the device in /data/data/my-app/lib.) I've done a lot of reading and it seems that the only way to solve this is to load them using System.loadLibrary before launching my native activity. I think I'd prefer load them dynamically using dlopen before taking that approach. Am I correct in assuming that Android wont automatically load the shared libraries my native activity(i.e. my shared library) depends on? I would build it as a static library but it was over 54Mb which wont work. This is my Android.mk: I've tried adding -lassimp to LOCAL_LDLIBS. I'm not sure if that would be correct but it didn't make any difference. LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := assimp LOCAL_SRC_FILES := libassimp.so include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := native-activity LOCAL_SRC_FILES := main.cpp LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv2 LOCAL_STATIC_LIBRARIES := android_native_app_glue LOCAL_SHARED_LIBRARIES := assimp LOCAL_CPPFLAGS += -march=armv7-a -mfloat-abi=softfp LOCAL_CFLAGS := $(LOCAL_CPPFLAGS) TARGET_ARCH_ABI := armeabi-v7a LOCAL_C_INCLUDES += $(LOCAL_PATH) include $(BUILD_SHARED_LIBRARY) $(call import-module,android/native_app_glue)
Tags (comma-separated)
Save Edits
Cancel