图被吃了,明天补 一、导入工程: 选中项目的根目录,我这里是xiyou2 导入后选中这两项:android和java 导入成功后,右键libcocos2dx属性-》Android,选择自己需要的api,勾选islibrary 右键项
图被吃了,明天补
一、导入工程:
选中项目的根目录,我这里是xiyou2
导入后选中这两项:android和java
导入成功后,右键libcocos2dx属性-》Android,选择自己需要的api,勾选islibrary
右键项目属性-》Android, 把之前的lib删除,add刚才添加的libcocos2dx,会有一个绿色的对勾
二,配置环境
window-》preferences -》Android,添加sdk路径
window-》preferences -》Android-》ndk,添加ndk路径
三,编译环境
右键项目属性 -》 builders-》new-》program
名字 ndkj-build路径 项目路径
x 表示项目的路径
NDK_MODULE_PATH
x\frameworks\cocos2d-x\cocos;x\frameworks\cocos2d-x;x\frameworks\cocos2d-x\external;
选中jni
android.mk
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) #LOCAL_ALLOW_UNDEFINED_SYMBOLS := true LOCAL_MODULE := cocos2dlua_shared LOCAL_MODULE_FILENAME := libcocos2dlua MY_CPP_LIST := $(wildcard $(LOCAL_PATH)/*.cpp) MY_CPP_LIST += $(wildcard $(LOCAL_PATH)/hellolua/*.cpp) MY_CPP_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/src/*.c) MY_CPP_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/*.cpp) MY_CPP_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/*.c) LOCAL_SRC_FILES := $(MY_CPP_LIST:$(LOCAL_PATH)/%=%) LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes # _COCOS_HEADER_ANDROID_BEGIN # _COCOS_HEADER_ANDROID_END LOCAL_STATIC_LIBRARIES := cocos2d_lua_static # _COCOS_LIB_ANDROID_BEGIN # _COCOS_LIB_ANDROID_END include $(BUILD_SHARED_LIBRARY) $(call import-module,scripting/lua-bindings/proj.android) # _COCOS_LIB_IMPORT_ANDROID_BEGIN # _COCOS_LIB_IMPORT_ANDROID_END
Application.mk
#APP_BUILD_SCRIPT := Android.mk NDK_TOOLCHAIN_VERSION = 4.9 APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char APP_LDFLAGS := -latomic APP_ABI := armeabi APP_PLATFORM := android-9 ifeq ($(NDK_DEBUG),1) APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 APP_OPTIM := debug else APP_CPPFLAGS += -DNDEBUG APP_OPTIM := release endif