export NDK_ROOT=/home/liyuchen/dev/android-ndk-r9d export NDK_MODULE_PATH=/home/liyuchen/dev/cocos2d-x-2.2.1/cocos2dx
./build_native.sh此处报错多与ndk版本有关
通常到达这一步会报错,如果是缺少源文件,请到cocos2d-x-2.2.1/cocos2dx/platform/android/java/src目录下的全部文件导入到eclipse工程中的src下
如果新建的工程不需要修改,跳过此步。如果已有的工程要移植到安卓,将新建的源文件添加到Android.mk文件中,这个文件类似于makefile文件,例如在Classes目录下新增了MainScene.cpp,那么需要做如下修改(红色部分为修改)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cocos2dcpp_shared
LOCAL_MODULE_FILENAME := libcocos2dcpp
LOCAL_SRC_FILES := hellocpp/main.cpp ../../Classes/AppDelegate.cpp ../../Classes/HelloWorldScene.cpp ../../Classes/MainScene.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
include $(BUILD_SHARED_LIBRARY)
$(call import-module,cocos2dx)
$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libcurl)
$(call import-module,CocosDenshion/android)
$(call import-module,extensions)
$(call import-module,external/Box2D)
$(call import-module,external/chipmunk)
android:screenOrientation="landscape"修改为 android:screenOrientation="portrait"
ubuntu12.10 cocos2dx 2.2.1 工程移植到安卓,布布扣,bubuko.com
ubuntu12.10 cocos2dx 2.2.1 工程移植到安卓
原文:http://blog.csdn.net/aspnet_lyc/article/details/25544481