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.
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>