Android studio Cocos2d-x 学习,配置到运行
官方提供的中文文档
下面是一个博主写的博客
http://xuzhiwei.blog.51cto.com/978424/1401434
根据这个博客说的,我要配置下环境,我就按他来弄,而已
小弟开发环境是ubuntu
1配置环境
moziqi@moziqi:~$ cd /home/moziqi/software/cocos2d-x-3.5 moziqi@moziqi:~/software/cocos2d-x-3.5$ ./start.py bash: ./start.py: 没有那个文件或目录 moziqi@moziqi:~/software/cocos2d-x-3.5$ ./setup.py Setting up cocos2d-x... ->Check environment variable COCOS_CONSOLE_ROOT ->Search for environment variable COCOS_CONSOLE_ROOT... ->COCOS_CONSOLE_ROOT not found -> Add COCOS_CONSOLE_ROOT environment variable... ->Added COCOS_CONSOLE_ROOT=/home/moziqi/software/cocos2d-x-3.5/tools/cocos2d-console/bin ->Check environment variable COCOS_TEMPLATES_ROOT ->Search for environment variable COCOS_TEMPLATES_ROOT... ->COCOS_TEMPLATES_ROOT not found -> Add COCOS_TEMPLATES_ROOT environment variable... ->Added COCOS_TEMPLATES_ROOT=/home/moziqi/software/cocos2d-x-3.5/templates ->Configuration for Android platform only, you can also skip and manually edit "/home/moziqi/.bashrc" ->Check environment variable NDK_ROOT ->Search for environment variable NDK_ROOT... ->NDK_ROOT not found ->Search for command ndk-build in system... ->Command ndk-build not found ->Please enter the path of NDK_ROOT (or press Enter to skip):/home/moziqi/software/android-ndk-r9d -> Add NDK_ROOT environment variable... ->Added NDK_ROOT=/home/moziqi/software/android-ndk-r9d ->Check environment variable ANDROID_SDK_ROOT ->Search for environment variable ANDROID_SDK_ROOT... ->ANDROID_SDK_ROOT not found ->Search for command android in system... ->Command android not found ->Please enter the path of ANDROID_SDK_ROOT (or press Enter to skip):/home/moziqi/software/android-studio/adt-bundle-linux-x86_64-20140702/sdk -> Add ANDROID_SDK_ROOT environment variable... ->Added ANDROID_SDK_ROOT=/home/moziqi/software/android-studio/adt-bundle-linux-x86_64-20140702/sdk ->Check environment variable ANT_ROOT ->Search for environment variable ANT_ROOT... ->ANT_ROOT not found ->Search for command ant in system... ->Command ant not found ->Please enter the path of ANT_ROOT (or press Enter to skip):/home/moziqi/software/apache-ant-1.9.4 ->Error: "/home/moziqi/software/apache-ant-1.9.4" is not a valid path of ANT_ROOT. Ignoring it. A backup file "/home/moziqi/.bashrc.backup" is created for "/home/moziqi/.bashrc". Please execute command: "source /home/moziqi/.bashrc" to make added system variables take effect moziqi@moziqi:~/software/cocos2d-x-3.5$ source /home/moziqi/.bashrc moziqi@moziqi:~/software/cocos2d-x-3.5$
2.使用cocos2dx 创建一个项目
moziqi@moziqi:~$ cd /home/moziqi/software/cocos2d-x-3.5 moziqi@moziqi:~/software/cocos2d-x-3.5$ cocos -h /home/moziqi/software/cocos2d-x-3.5/tools/cocos2d-console/bin/cocos.py 1.5 - cocos console: A command line tool for cocos2d-x Available commands: run Compiles & deploy project and then runs it on the target luacompile minifies and/or compiles lua files deploy Deploy a project to the target package Manage package for cocos compile Compiles the current project to binary framework Manage frameworks for the project new Creates a new project jscompile minifies and/or compiles js files Available arguments: -h, --help Show this help information -v, --version Show the version of this command tool Example: /home/moziqi/software/cocos2d-x-3.5/tools/cocos2d-console/bin/cocos.py new --help /home/moziqi/software/cocos2d-x-3.5/tools/cocos2d-console/bin/cocos.py run --help moziqi@moziqi:~/software/cocos2d-x-3.5$ cocos new -h usage: cocos new [-h] [-p PACKAGE_NAME] -l {cpp,lua,js} [-d DIRECTORY] [-t TEMPLATE_NAME] [--ios-bundleid IOS_BUNDLEID] [--mac-bundleid MAC_BUNDLEID] [-e ENGINE_PATH] [--portrait] [--no-native] [PROJECT_NAME] Creates a new project positional arguments: PROJECT_NAME Set the project name optional arguments: -h, --help show this help message and exit -p PACKAGE_NAME, --package PACKAGE_NAME Set a package name for project -l {cpp,lua,js}, --language {cpp,lua,js} Major programming language you want to use, should be [cpp | lua | js] -d DIRECTORY, --directory DIRECTORY Set generate project directory for project -t TEMPLATE_NAME, --template TEMPLATE_NAME Set the template name you want create from --ios-bundleid IOS_BUNDLEID Set a bundle id for ios project --mac-bundleid MAC_BUNDLEID Set a bundle id for mac project -e ENGINE_PATH, --engine-path ENGINE_PATH Set the path of cocos2d-x/cocos2d-js engine --portrait Set the project be portrait. lua/js project arguments: --no-native No native support. moziqi@moziqi:~/software/cocos2d-x-3.5$ cocos new -p com.mo.coco -l cpp -d /home/moziqi/software/android-studio-work/cocos2dx test3.5 Running command: new > Copy template into /home/moziqi/software/android-studio-work/cocos2dx/test3.5 > Copying cocos2d-x files... > Rename project name from ‘HelloCpp‘ to ‘test3.5‘ > Replace the project name from ‘HelloCpp‘ to ‘test3.5‘ > Replace the project package name from ‘org.cocos2dx.hellocpp‘ to ‘com.mo.coco‘ > Replace the mac bundle id from ‘org.cocos2dx.hellocpp‘ to ‘com.mo.coco‘ > Replace the ios bundle id from ‘org.cocos2dx.hellocpp‘ to ‘com.mo.coco‘ moziqi@moziqi:~/software/cocos2d-x-3.5$
一般都是正常运行OK的,就在对于的目录生成一个目录
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。