Open the user folder under the. bash_profile file, configure the environment
Vim ~/.bash_profile//Key I, insert edit (assuming error D to delete one row)
The environment configuration process is as follows:
1, first configure under the Android SDK, my is in the OPT folder
#sdkexport android_sdk_root=/opt/android-sdk-macosxexport path= $PATH: $ANDROID _sdk_rootexport path= $PATH: $ANDROID _ Sdk_root/platform-tools
2. NDK
#ndkexport ndk_root=/opt/android-ndk-r9bexport path= $PATH: $NDK _root
3. Ant
#antexport ant_root=/opt/apache-ant-1.9.3/binexport path= $PATH: $ANT _root
When everything is configured, we should now run the following command under the cocos2d-x3.0 folder under the terminal:
./setup.py
After running, the terminal will display the following content
??? mcbookpro:cocos2d-x-3.0$./setup.py Setting up cocos2d-x...->check environment variable Cocos_console_root Find environment variable Cocos_console_root ...->cocos_console_root is found:/project/cocos2d-x-3.0/tools/cocos2 D-console/bin->configuration for Android platform only, you can also skip and manually edit "/users/your USERNAME/.BASH_PR Ofile "->check environment variable ndk_root->find environment variable ndk_root ...->ndk_root is found:/op T/android-ndk-r9b->check environment variable android_sdk_root->find environment variable android_sdk_root ...- >android_sdk_root is found:/opt/android-sdk-macosx->check environment variable ant_root->find environment VA Riable ant_root->ant_root is found:/opt/apache-ant-1.9.3/binplease Execute command: "source/users/your username/ . Bash_profile "To make added system variables take effect
Assuming that the above content of our configuration is successful, you go to your/users/your username/.bash_profile file to see, will assume that we add the following two lines of code
# ADD environment variable cocos_console_root for Cocos2d-xexport cocos_console_root=/project/cocos2d-x-3.0/tools/ Cocos2d-console/binexport path= $COCOS _console_root: $PATH
You can then restart or run the following code:
Source/users/your username/.bash_profile.
After the run is finished, there is no hint whatsoever. No matter, there is no news in Linux, is the good news.
After you have finished, you will be surprised to find that you are knocking at the terminal under the Cocos New command.
mcbookpro:cocos2d-x-3.0$ Cocos newruning Command:newusage:cocos New [-h] [-P package_name]-l {CPP,LUA,JS} [-D DIRECTORY ] [-t template_name] [--no-native] [Project_name]cocos new:error:argument-l/--language is required
You can tap the following command to create your own project:
Cocos New Wxycocostemplate-p com.game.study-l cpp-d/users/more2010wei/documents/more2010wei/cocos2dproj/
The parameter descriptions are as follows:
Wxycocostemplate//project name -P followed by your package name-L CPP
After the command finishes running, the terminal appears:
runing command:new> Copy Template into/users/more2010wei/documents/more2010wei/cocos2dproj/wxycocostemplate> Copying cocos2d-x files...> Rename project name from ' Hellocpp ' to ' WXYCocosTemplate1 ' > Replace the project name fro M ' hellocpp ' to ' WXYCocosTemplate1 ' > Replace the "Project package" name from ' org.cocos2dx.hellocpp ' to ' com.game.study '
The configuration is now complete. Start enjoying the fun of game development.
Cocos2d-x 3.x Game Development Learning Note (1)--MAC Configuration Cocos2d-x 3.x development environment