cocos2d-x3.0 Android环境配置

来源:未知 责任编辑:责任编辑 发表时间:2013-12-01 14:15 点击:
看了网上的各种blog,要么是太旧,要么是我弄了依然不行,只有自己折腾,下面写出解决办法: p>首先,官方文档最权威!用py创建跨平台project后会生成proj.android文件夹,里面有个文件README.md

p>打开

p>按照里面的一步一步来:

p>#### Setup Eclipse Environment (only once)

p> 

p> 

p> 

p> 

p>**NOTE:** This step needs to be done only once to setup the Eclipse environment for cocos2d-x projects. Skip this section if you've done this before.

p> 

p> 

p>1. Download Eclipse ADT bundle from [Google ADT homepage](http://developer.android.com/sdk/index.html)

p> 

p> 

p>   **OR**

p> 

p> 

p>   Install Eclipse with Java. Add ADT and CDT plugins.

p> 

p> 

p>2. Only for Windows

p>    1. Install [Cygwin](http://www.cygwin.com/) with make (select make package from the list during the install).(这步可以搜索其他博文,一定要确认安装成功)

p>    2. Add `Cygwin\bin` directory to system PATH variable.

p>    3. Add this line `none /cygdrive cygdrive binary,noacl,posix=0,user 0 0` to `Cygwin\etc\fstab` file.

p>   

p>3. Set up Variables: 

p>1. Path Variable `COCOS2DX`: 

p>* Eclipse->Preferences->General->Workspace->**Linked Resources**

p>* Click **New** button to add a Path Variable `COCOS2DX` pointing to the root cocos2d-x directory.

p>![Example](https://lh5.googleusercontent.com/-oPpk9kg3e5w/UUOYlq8n7aI/AAAAAAAAsdQ/zLA4eghBH9U/s400/cocos2d-x-eclipse-vars.png)

p> 

p> 

p>2. C/C++ Environment Variable `NDK_ROOT`: 

p>* Eclipse->Preferences->C/C++->Build->**Environment**.

p>* Click **Add** button and add a new variable `NDK_ROOT` pointing to the root NDK directory.

p>![Example](https://lh3.googleusercontent.com/-AVcY8IAT0_g/UUOYltoRobI/AAAAAAAAsdM/22D2J9u3sig/s400/cocos2d-x-eclipse-ndk.png)

p>* Only for Windows: Add new variables **CYGWIN** with value `nodosfilewarning` and **SHELLOPTS** with value `igncr`

p> 

p>4. Import libcocos2dx library project:

p>1. File->New->Project->Android Project From Existing Code.

p>2. Click **Browse** button and open `cocos2d-x/cocos2dx/platform/android/java` directory.

p>3. Click **Finish** to add project.

p> 

p>#### Adding and running from Eclipse

p> 

p> 

p>![Example](https://lh3.googleusercontent.com/-SLBOu6e3QbE/UUOcOXYaGqI/AAAAAAAAsdo/tYBY2SylOSM/s288/cocos2d-x-eclipse-project-from-code.png) ![Import](https://lh5.googleusercontent.com/-XzC9Pn65USc/UUOcOTAwizI/AAAAAAAAsdk/4b6YM-oim9Y/s400/cocos2d-x-eclipse-import-project.png)

p> 

p> 

p>1. File->New->Project->Android Project From Existing Code

p>2. **Browse** to your project directory. eg: `cocos2d-x/cocos2dx/samples/Cpp/TestCpp/proj.android/`

p>3. Add the project 

p>4. Click **Run** or **Debug** to compile C++ followed by Java and to run on connected device or emulator.
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
用户名: 验证码:点击我更换图片
最新评论 更多>>

推荐热点

  • cocos2d-x学习笔记(19)--label 、label atlas
  • cocos2d-x学习笔记(23)--地图的使用3--CCTMXLayer
  • Cocos2d-x学习(一):HelloWorld
  • cocos2dx在xcode下开发,编译到android上(2)
  • cocos2d 设置屏幕默认方向
  • Cocos2d-x 2.0 之 Actions “三板斧” 之一
  • cocos2d-x学习笔记(22)--地图的使用2(TMX) --Z-Order、AnchorPoi
  • cocos2d-x学习笔记(18)--游戏打包(windows平台)
  • cocos2d-x学习笔记(16)--spritesheet(精灵表单)
网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
Copyright © 2008-2015 计算机技术学习交流网. 版权所有

豫ICP备11007008号-1