环境配置如下:http://www.cnblogs.com/Richard-Core/p/3855130.html
1.公司的项目cocos命令找不到,并且已经安装了cocos命令。
cocos2d-x-3.2\tools\cocos2d-console\bin下的文件都没了,直接拷贝一份新的引擎文件过来吧。
2.打包报错:
-dex:
[dex] input: D:\XMTexas\proj.android\bin\classes
[dex] input: D:\XMTexas\cocos2d\cocos\platform\android\java\bin\classes.ja
r
[dex] input: D:\XMTexas\proj.android\libs\umeng-analytics-v5.2.4.jar
[dex] input: D:\XMTexas\proj.android\libs\SDK_MIBox_1.0.2.jar
[dex] Pre-Dexing D:\XMTexas\cocos2d\cocos\platform\android\java\bin\classe
s.jar -> classes-2449ffbc5c3aa61b066ecea427b7ac37.jar
[dex] Pre-Dexing D:\XMTexas\proj.android\libs\umeng-analytics-v5.2.4.jar -
> umeng-analytics-v5.2.4-6949540ab729bbd0f84bdb29012b067f.jar
[dex] Pre-Dexing D:\XMTexas\proj.android\libs\SDK_MIBox_1.0.2.jar -> SDK_M
IBox_1.0.2-53d55151651da0e90b7e4feef3a6f130.jar
[dex] Converting compiled files and external libraries into D:\XMTexas\pro
j.android\bin\classes.dex...
[dx]
[dx] UNEXPECTED TOP-LEVEL EXCEPTION:
[dx] com.android.dex.DexException: Multiple dex files define Lorg/cocos2d
x/lib/Cocos2dxAccelerometer;
[dx] at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.ja
va:596)
[dx] at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:
554)
[dx] at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:
535)
[dx] at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
[dx] at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
[dx] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main
.java:454)
[dx] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:302)
[dx] at com.android.dx.command.dexer.Main.run(Main.java:245)
[dx] at com.android.dx.command.dexer.Main.main(Main.java:214)
[dx] at com.android.dx.command.Main.main(Main.java:106)
[dx]
BUILD Failed
D:\Tools\android-tools\android-sdk-windows\tools\ant\build.xml:892: The followin
g error occurred while executing this line:
D:\Tools\android-tools\android-sdk-windows\tools\ant\build.xml:894: The followin
g error occurred while executing this line:
D:\Tools\android-tools\android-sdk-windows\tools\ant\build.xml:906: The followin
g error occurred while executing this line:
D:\Tools\android-tools\android-sdk-windows\tools\ant\build.xml:283: null returne
d: 2
最后的xml的错误不是主要问题,请仔细阅读上面的出错信息。UNEXPECTED TOP-LEVEL EXCEPTION:
这个时候的解决办法就是更新sdk。
原文链接:https://www.f2er.com/cocos2dx/346151.html