cocos2d移植到安卓引入第三方so文件时候编译会删除解决方案

前端之家收集整理的这篇文章主要介绍了cocos2d移植到安卓引入第三方so文件时候编译会删除解决方案前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

第一步,在项目导入安卓中之后,在对应的jni文件夹中创建一个prebuilt的文件夹,把要导入的so文件全部复制进去

第二步:修改jni下面的Android.mk

LOCAL_PATH := $(call my-dir)

##添加下面##
include $(CLEAR_VARS)
LOCAL_MODULE    := jpush205
LOCAL_SRC_FILES := prebuilt/$(TARGET_ARCH_ABI)/libjpush205.so
include $(PREBUILT_SHARED_LIBRARY)
##添加结束##

include $(CLEAR_VARS)

LOCAL_CFLAGS := -fshort-wchar  

$(call import-add-path,$(LOCAL_PATH)/../../cocos2d)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/external)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/cocos)

LOCAL_MODULE := cocos2dcpp_shared

LOCAL_MODULE_FILENAME := libcocos2dcpp
FILE_LIST := hellocpp/main.cpp  \
            $(wildcard $(LOCAL_PATH)/../../Classes/*.cpp) \
            $(wildcard $(LOCAL_PATH)/../../Classes/com/*.cpp) \
            $(wildcard $(LOCAL_PATH)/../../Classes/CWHEncrypt/*.cpp) \
            $(wildcard $(LOCAL_PATH)/../../Classes/global/*.cpp) \
            $(wildcard $(LOCAL_PATH)/../../Classes/iconv/*.cpp) \
            $(wildcard $(LOCAL_PATH)/../../Classes/land/*.cpp) \
            $(wildcard $(LOCAL_PATH)/../../Classes/plaza/*.cpp) \
            $(wildcard $(LOCAL_PATH)/../../Classes/scene/*.cpp) \
            $(wildcard $(LOCAL_PATH)/../../Classes/socket/*.cpp) \
            $(wildcard $(LOCAL_PATH)/../../Classes/userData/*.cpp) \


LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)  

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/../../../iconv/include \
$(LOCAL_PATH)/../../../iconv/libcharset \
$(LOCAL_PATH)/../../../iconv/lib \
$(LOCAL_PATH)/../../../iconv/libcharset/include \
$(LOCAL_PATH)/../../../iconv/srclib \
$(LOCAL_PATH)/../../../iconv


# _COCOS_HEADER_ANDROID_BEGIN
# _COCOS_HEADER_ANDROID_END


LOCAL_STATIC_LIBRARIES := cocos2dx_static  iconv_static

# _COCOS_LIB_ANDROID_BEGIN
# _COCOS_LIB_ANDROID_END

include $(BUILD_SHARED_LIBRARY)

$(call import-module,.)

$(call import-module,iconv)

# _COCOS_LIB_IMPORT_ANDROID_BEGIN
# _COCOS_LIB_IMPORT_ANDROID_END

猜你在找的Cocos2d-x相关文章