Configure the cocos2dx Android development environment in MACOs

Source: Internet
Author: User

1. JDK has been pre-installed in Mac OS. You can use Java-version to view the current version.

2. Eclipse: Download the eclipse sdkintegrated package adt-bundle-mac-x86_64.zip from the android develop website,

This includes Elipse + ADT plugin, Android SDK tools, Android platforms-tool, and the latest Android platform.

Http://developer.android.com/tools/sdk/index.html

Http://developer.android.com.nyud.net/sdk/index.html

ADT: Android Developers tools

Decompress the eclipse sdkpackage adt-bundle-mac-x86_64.zip to the user directory, which contains two directories: eclise and SDK. Eclipse integrates the eclipse of the ADT plug-in and runs the eclipse. app file under the eclipse directory to start eclipse.

3. ndk

Http://developer.android.com/tools/sdk/ndk/index.html

4. cocos2d-x

5. ndk_root

Enter nano ~ In the Console ~ /. Bash_profile, add content export ndk_root = "/users/gzty1/adt-bundle-mac-x86_64/ndk"

Or directly open the file with text to modify the. bash_profile file and add the statement export ndk_root = "/users/gzty1/adt-bundle-mac-x86_64/ndk" with double quotation marks.

6. ndk_root_local

Android_sdk_root_local

Modify in the coocs2d-x file under the create-android-project.sh directory:

# Set environment paramters
Ndk_root_local = "/users/gzty1/adt-bundle-mac-x86_64/ndk"
Android_sdk_root_local = "/users/gzty1/adt-bundle-mac-x86_64/SDK"

7. the terminal runs the coocs2d-x under the create-android-project.sh directory, follow the prompts to enter the package name, SDK number, project name, after success a folder with the same name as the name of the just entered project appears under the cocos2dx directory.

Method of executing. sh:./create-android-project.sh

8. build_native.sh In the proj. Android directory generated by running the terminal

If the error message "prompt Please define ndk_root" appears, open the file, enter ndk_root = "/users/gzty1/adt-bundle-mac-x86_64/ndk" in the file header, and add each build_native.

Run build_native.sh. The compilation is successful!

9. Open eclipse, new Android project from existing code, and select the generated project name/proj. Android directory.

If you select the Android 4.2 SDK, The androidmanifest. xml file in the project will report that the @ drawable/icon file cannot be found because the file path is different. Switch to the application panel, icon... broswe..., and select ic_launcher.

The import Org. cocos2dx. lib cannot be resolved, because the corresponding Java code is missing in the project, and the directories have been created, but it seems that there is a problem with copying the script and the source files are not copied. Copy the/users/gzty1/cocos2dx/cocos2dx/platform/Android/Java/src/org/cocos2dx lib directory to/users/gzty1/cocos2dx/knowledgegamex/proj. android/src/org/cocos2dx.

10. Then test the real machine.

If you want to modify the code, you need to delete the OBJ and libs directories under the project directory, and then run build_native.sh under the project in step 8th again. Then remember to use eclipse-> Project-> clean... run again.

For convenience, you can add two Rm-RF folders to the top of the build_native file.

11. cocos2d-2.0-x-2.0.2/samples has examples of learning resources, according to the above steps (starting from build_native.sh), you can compile to run testcpp to the phone.

Note: do not duplicate the package name with org. cocos2dx. Because a running error occurs, it is normal after the package name is completely modified.

/Users/wangweike/x_workspace/cocos2d/knowledgegamex/libs/cocos2dx/platform/third_party/IOS/libraries has a library file libcurl.. You need to use the command line to upload data to SVN.

Ld: library not found for-lcurl

Reference

Http://www.cnblogs.com/sslin/archive/2013/01/15/2861383.html

Http://www.verydemo.com/demo_c158_i2646.html

Http://www.cocoachina.com/bbs/simple? T129743.html

12. jsoncpp Android Compiler

JSON/reader. h: no such file or directory

Exception Handling disabled

Http://blog.sina.com.cn/s/blog_643e838601015zbo.html

Http://blog.csdn.net/happyrabbit456/article/details/8063054

Http://lzyathere.blog.163.com/blog/static/50834467201291554318/

Http://www.cocos2dev.com /? P = 299

13. Test on the android real machine shows that the getcontentsize () of the cclayer and ccnode subclass may be smaller than or equal to 0, which causes the program to fail.

14. Install the CDT plug-in eclipse to support C ++ editing.

Help/install new software. In the work with drop-down list, select an item that contains the name of your eclipse version, for example, Juno-http://download.eclipse.org/releases/juno, find programming versions in the plug-in tree, and select C/C ++ development tools
Next...

15.

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.