首页 > 代码库 > 用 批处理 安装,编译 Cocos2d-X 3.0---Windows

用 批处理 安装,编译 Cocos2d-X 3.0---Windows

本文档适用:
  • Win7 32bits(XP 32bits可能适用,未測试)
  • 开发目标环境 Android

软件版本号 2014年5月下载,当时为较新版本号.

由于Cocos2d-X从 2.x到3.0 编译方法发生了改变,网上有非常多2.x的,3.0的 也有,但不全面. 我东拼西凑才得以完毕. 同一时候感谢CSDN,51cto上写blog的人们.假设不是他们的文档,结果非常难成功.

1 . 下载文件 我把要下载的所有文件放在baidu 盘了.在Win7 裸机上測试通过.

http:// pan.baidu.com/s/1pJsJCXd

技术分享

2 . 安装python (默认文件夹)

C:\Python27;

3 . 安装jdk-8u5 (默认文件夹)

C:\Program Files\Java\jdk1.8.0_05;

4 . 解压缩 以下4个文件到同一个文件夹

<ol style="margin: 0px 0px 0px 33px; padding: 0px;" class="linenums"><li style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 12px;" class="L0"><code style="padding: 0px; border: 0px currentColor; color: inherit; font-family: Monaco,Menlo,Consolas,‘Courier New‘,monospace; font-size: 12px; background-color: transparent;"><span class="lit" style="color:#195f91;">2014</span><span class="pun" style="color:#93a1a1;">/</span><span class="lit" style="color:#195f91;">05</span><span class="pun" style="color:#93a1a1;">/</span><span class="lit" style="color:#195f91;">12</span><span class="pln" style="color:#48484c;">  </span><span class="lit" style="color:#195f91;">16</span><span class="pun" style="color:#93a1a1;">:</span><span class="lit" style="color:#195f91;">30</span><span class="pln" style="color:#48484c;">       </span><span class="lit" style="color:#195f91;">535</span><span class="pun" style="color:#93a1a1;">,</span><span class="lit" style="color:#195f91;">085</span><span class="pun" style="color:#93a1a1;">,</span><span class="lit" style="color:#195f91;">536</span><span class="pln" style="color:#48484c;"> adt</span><span class="pun" style="color:#93a1a1;">-</span><span class="pln" style="color:#48484c;">bundle</span><span class="pun" style="color:#93a1a1;">-</span><span class="pln" style="color:#48484c;">windows</span><span class="pun" style="color:#93a1a1;">-</span><span class="pln" style="color:#48484c;">x86</span><span class="pun" style="color:#93a1a1;">-</span><span class="lit" style="color:#195f91;">20140321.zip</span></code></li><li style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 12px;" class="L1"><code style="padding: 0px; border: 0px currentColor; color: inherit; font-family: Monaco,Menlo,Consolas,‘Courier New‘,monospace; font-size: 12px; background-color: transparent;"><span class="lit" style="color:#195f91;">2014</span><span class="pun" style="color:#93a1a1;">/</span><span class="lit" style="color:#195f91;">05</span><span class="pun" style="color:#93a1a1;">/</span><span class="lit" style="color:#195f91;">09</span><span class="pln" style="color:#48484c;">  </span><span class="lit" style="color:#195f91;">07</span><span class="pun" style="color:#93a1a1;">:</span><span class="lit" style="color:#195f91;">32</span><span class="pln" style="color:#48484c;">       </span><span class="lit" style="color:#195f91;">491</span><span class="pun" style="color:#93a1a1;">,</span><span class="lit" style="color:#195f91;">440</span><span class="pun" style="color:#93a1a1;">,</span><span class="lit" style="color:#195f91;">074</span><span class="pln" style="color:#48484c;"> android</span><span class="pun" style="color:#93a1a1;">-</span><span class="pln" style="color:#48484c;">ndk</span><span class="pun" style="color:#93a1a1;">-</span><span class="pln" style="color:#48484c;">r9d</span><span class="pun" style="color:#93a1a1;">-</span><span class="pln" style="color:#48484c;">windows</span><span class="pun" style="color:#93a1a1;">-</span><span class="pln" style="color:#48484c;">x86</span><span class="pun" style="color:#93a1a1;">.</span><span class="pln" style="color:#48484c;">zip</span></code></li><li style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 12px;" class="L2"><code style="padding: 0px; border: 0px currentColor; color: inherit; font-family: Monaco,Menlo,Consolas,‘Courier New‘,monospace; font-size: 12px; background-color: transparent;"><span class="lit" style="color:#195f91;">2014</span><span class="pun" style="color:#93a1a1;">/</span><span class="lit" style="color:#195f91;">05</span><span class="pun" style="color:#93a1a1;">/</span><span class="lit" style="color:#195f91;">21</span><span class="pln" style="color:#48484c;">  </span><span class="lit" style="color:#195f91;">14</span><span class="pun" style="color:#93a1a1;">:</span><span class="lit" style="color:#195f91;">24</span><span class="pln" style="color:#48484c;">         </span><span class="lit" style="color:#195f91;">8</span><span class="pun" style="color:#93a1a1;">,</span><span class="lit" style="color:#195f91;">309</span><span class="pun" style="color:#93a1a1;">,</span><span class="lit" style="color:#195f91;">406</span><span class="pln" style="color:#48484c;"> apache</span><span class="pun" style="color:#93a1a1;">-</span><span class="pln" style="color:#48484c;">ant</span><span class="pun" style="color:#93a1a1;">-</span><span class="lit" style="color:#195f91;">1.9</span><span class="pun" style="color:#93a1a1;">.</span><span class="lit" style="color:#195f91;">4</span><span class="pun" style="color:#93a1a1;">-</span><span class="pln" style="color:#48484c;">bin</span><span class="pun" style="color:#93a1a1;">.</span><span class="pln" style="color:#48484c;">zip</span></code></li><li style="color: rgb(190, 190, 197); line-height: 18px; padding-left: 12px;" class="L3"><code style="padding: 0px; border: 0px currentColor; color: inherit; font-family: Monaco,Menlo,Consolas,‘Courier New‘,monospace; font-size: 12px; background-color: transparent;"><span class="lit" style="color:#195f91;">2014</span><span class="pun" style="color:#93a1a1;">/</span><span class="lit" style="color:#195f91;">05</span><span class="pun" style="color:#93a1a1;">/</span><span class="lit" style="color:#195f91;">05</span><span class="pln" style="color:#48484c;">  </span><span class="lit" style="color:#195f91;">15</span><span class="pun" style="color:#93a1a1;">:</span><span class="lit" style="color:#195f91;">23</span><span class="pln" style="color:#48484c;">       </span><span class="lit" style="color:#195f91;">265</span><span class="pun" style="color:#93a1a1;">,</span><span class="lit" style="color:#195f91;">044</span><span class="pun" style="color:#93a1a1;">,</span><span class="lit" style="color:#195f91;">214</span><span class="pln" style="color:#48484c;"> cocos2d</span><span class="pun" style="color:#93a1a1;">-</span><span class="pln" style="color:#48484c;">x</span><span class="pun" style="color:#93a1a1;">-</span><span class="lit" style="color:#195f91;">3.0</span><span class="pun" style="color:#93a1a1;">.</span><span class="pln" style="color:#48484c;">zip</span></code></li></ol>

我放在 C:\Users\chinagame\

5 . 改动路径而且运行脚本

同一时候把cg_start.bat 放在 C:\Users\chinagame\

改动: cg_start.bat 第一行

set CG_ROOT=C:\Users\chinagame\

运行cg_start.bat


cd project\helloword

cocos run -p android

假设顺利就编出 helloworld.apk

技术分享



这样的方法并没有把设置 放到 环境变量; 大家最好自己手动配置下面;或者等我写个程序 改动注冊表.....

用 批处理 安装,编译 Cocos2d-X 3.0---Windows