标签:des android blog http 使用 os io strong
在mac下好不容写完了游戏,本以为轻轻松松就能编译为android项目,想不到弄了将近1整天才将问题解决
首先不带jsoncpp的编译方式请参考:http://www.bold-it.com/ios/cocos2d-x-box2d-iosandroid-hybrid-tutorial/
带jsoncpp第三方库的参考了http://blog.csdn.net/sniffer12345/article/details/7336732,对作者表示感谢。
我使用的是正常的jsoncpp版本,在jsoncpp文件夹内新建个Android.mk,内容为
- LOCAL_PATH := $(call my-dir)
- include $(CLEAR_VARS)
-
- LOCAL_MODULE := jsoncpp_static
-
- LOCAL_MODULE_FILENAME := libjsoncpp
-
- LOCAL_CPPFLAGS := -fexceptions
-
- LOCAL_SRC_FILES := src/lib_json/json_internalarray.inl \
- src/lib_json/json_internalmap.inl \
- src/lib_json/json_valueiterator.inl \
- src/lib_json/json_reader.cpp \
- src/lib_json/json_value.cpp \
- src/lib_json/json_writer.cpp
-
-
- LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/..
-
- LOCAL_C_INCLUDES := $(LOCAL_PATH)/..\
- $(LOCAL_PATH)/include \
- $(LOCAL_PATH)/src/lib_json
-
- include $(BUILD_STATIC_LIBRARY)
然后需要在proj.android/jni/Android.mk中修改配置,具体配置如下
- LOCAL_PATH := $(call my-dir)
-
- include $(CLEAR_VARS)
-
- LOCAL_MODULE := game_shared
-
- LOCAL_MODULE_FILENAME := libgame
-
- LOCAL_SRC_FILES := hellocpp/main.cpp \
- ../../Classes/AppDelegate.cpp \
- ../../Classes/BaseSprite.cpp\
- ../../Classes/GameLayer.cpp \
- ../../Classes/GameMenu.cpp \
- ../../Classes/GameScene.cpp \
- ../../Classes/JsonUtils.cpp \
- ../../Classes/LevelLayer.cpp \
- ../../Classes/LevelManager.cpp \
- ../../Classes/OptionScene.cpp \
- ../../Classes/SpriteFactory.cpp \
- ../../Classes/WelcomeLayer.cpp
-
- LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
- $(LOCAL_PATH)/../../libs/Box2d\
- $(LOCAL_PATH)/../../libs/jsoncpp/include/json/
-
- LOCAL_WHOLE_STATIC_LIBRARIES := jsoncpp_static cocosdenshion_static
- LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static
- LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
- LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static
-
-
- include $(BUILD_SHARED_LIBRARY)
-
- $(call import-module,jsoncpp) \
- $(call import-module,CocosDenshion/android) \
- $(call import-module,cocos2dx) \
- $(call import-module,extensions) \
- $(call import-module,Box2D)
如果还是发生错误请参考第一个链接中的配置方式(非常重要)
摘自:http://blog.csdn.net/ashqal/article/details/8728269
mac下cocos2dx(带jsoncpp第三方库)编译为android项目心得,布布扣,bubuko.com
mac下cocos2dx(带jsoncpp第三方库)编译为android项目心得
标签:des android blog http 使用 os io strong
原文地址:http://www.cnblogs.com/playerboy/p/3903332.html