[Cocos2d-x]解决Android平台ndk-build时不自动删除外部库

参考链接:

http://blog.chinaunix.net/uid-26009923-id-3430612.html

http://hi.baidu.com/hpyfei/item/52a2b21213de23031994ec63

做Cocos2d-x移植Android平台时候发现程序总是Crash,后来才发现,因为运行ndk-build时,libs/armeabi目录下的外部库被删除了,网上找到了解决方案,上文给出了原文链接

此处贴出解决方案,以作记录:

步骤如下:
a. 在 jni目录下新建目录prebuilt(名字任意取)
b. 将外部库libfoo_so.so libbar_so.so libfoo_a.a libbar_a.a放在新建的prebuilt目录中
c. 在prebuilt目录中创建Android.mk, 内容如下

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := foo_so
LOCAL_SRC_FILES := libfoo-so.so
include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS)
LOCAL_MODULE := bar_so
LOCAL_SRC_FILES := libbar_so.so
include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS)
LOCAL_MODULE := foo_a
LOCAL_SRC_FILES := libfoo_a.a
include $(PREBUILT_STATIC_LIBRARY) include $(CLEAR_VARS)
LOCAL_MODULE := bar_a
LOCAL_SRC_FILES := libbar_a.a
include $(PREBUILT_STATIC_LIBRARY)

d. 最后在需要使用外部库的Android.mk中加入(project/jni/android.mk的最后加入)

include $(LOCAL_PATH)/prebuilt/Android.mk

THE END

上一篇:jQuery安装


下一篇:angular作用域分析