Cocos2dx under Mac (with Jsoncpp third party libraries) compiled into Android project experience

Source: Internet
Author: User

Under the Mac good not to write the game, I thought it would be easy to compile into Android project, unexpectedly get nearly 1 days to solve the problem

First, without the Jsoncpp of the compilation method, please refer to: http://www.bold-it.com/ios/cocos2d-x-box2d-iosandroid-hybrid-tutorial/

With Jsoncpp third-party library reference http://blog.csdn.net/sniffer12345/article/details/7336732, the author expressed thanks.

I am using the normal version of Jsoncpp, in the Jsoncpp folder to create a new android.mk, the content is

[Plain]View Plaincopy
  1. Local_path: = $ (call My-dir)
  2. Include $ (clear_vars)
  3. Local_module: = jsoncpp_static
  4. Local_module_filename: = Libjsoncpp
  5. Local_cppflags: =-fexceptions
  6. Local_src_files: = src/lib_json/json_internalarray.inl \
  7. SRC/LIB_JSON/JSON_INTERNALMAP.INL \
  8. SRC/LIB_JSON/JSON_VALUEITERATOR.INL \
  9. Src/lib_json/json_reader.cpp \
  10. Src/lib_json/json_value.cpp \
  11. Src/lib_json/json_writer.cpp
  12. Local_export_c_includes: = $ (Local_path)/.
  13. Local_c_includes: = $ (Local_path)/. \
  14. $ (local_path)/include \
  15. $ (Local_path)/src/lib_json
  16. Include $ (build_static_library)


You will then need to modify the configuration in the Proj.android/jni/android.mk, which is configured as follows

[Plain]View Plaincopy
  1. Local_path: = $ (call My-dir)
  2. Include $ (clear_vars)
  3. Local_module: = game_shared
  4. Local_module_filename: = Libgame
  5. Local_src_files: = hellocpp/main.cpp \
  6. .. /.. /classes/appdelegate.cpp \
  7. .. /.. /classes/basesprite.cpp\
  8. .. /.. /classes/gamelayer.cpp \
  9. .. /.. /classes/gamemenu.cpp \
  10. .. /.. /classes/gamescene.cpp \
  11. .. /.. /classes/jsonutils.cpp \
  12. .. /.. /classes/levellayer.cpp \
  13. .. /.. /classes/levelmanager.cpp \
  14. .. /.. /classes/optionscene.cpp \
  15. .. /.. /classes/spritefactory.cpp \
  16. .. /.. /classes/welcomelayer.cpp
  17. Local_c_includes: = $ (Local_path)/. /.. /classes \
  18. $ (Local_path)/.. /.. /libs/box2d\
  19. $ (Local_path)/.. /.. /libs/jsoncpp/include/json/
  20. Local_whole_static_libraries: = Jsoncpp_static cocosdenshion_static
  21. Local_whole_static_libraries + = Cocos2dx_static
  22. Local_whole_static_libraries + = Cocos_extension_static
  23. Local_whole_static_libraries + = Box2d_static
  24. Include $ (build_shared_library)
  25. $ (call import-module,jsoncpp) \
  26. $ (call import-module,cocosdenshion/android) \
  27. $ (call import-module,cocos2dx) \
  28. $ (call import-module,extensions) \
  29. $ (call import-module,box2d)

If an error still occurs, refer to the configuration method in the first link (very important)

Excerpt from: http://blog.csdn.net/ashqal/article/details/8728269

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.