本文档适用:
- 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
这种方法并没有把设置 放到 环境变量; 大家最好自己手动配置以下;或者等我写个程序 修改注册表.....