编译cocos2d项目出错

编译cocos2d项目出错

运行 cocos run -p android

报错内容如下:

      [dx] UNEXPECTED TOP-LEVEL EXCEPTION:
       [dx] com.android.dex.DexException: Multiple dex files define Lorg/cocos2dx/lib/Cocos2dxBitmap$TextProperty;
       [dx] 	at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
       [dx] 	at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
       [dx] 	at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
       [dx] 	at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
       [dx] 	at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
       [dx] 	at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
       [dx] 	at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
       [dx] 	at com.android.dx.command.dexer.Main.run(Main.java:230)
       [dx] 	at com.android.dx.command.dexer.Main.main(Main.java:199)
       [dx] 	at com.android.dx.command.Main.main(Main.java:103)
       [dx] 

BUILD FAILED
/Users/leewolf/desktop/adt-bundle-mac-x86_64-20130522/sdk/tools/ant/build.xml:892: The following error occurred while executing this line:
/Users/leewolf/desktop/adt-bundle-mac-x86_64-20130522/sdk/tools/ant/build.xml:894: The following error occurred while executing this line:
/Users/leewolf/desktop/adt-bundle-mac-x86_64-20130522/sdk/tools/ant/build.xml:906: The following error occurred while executing this line:
/Users/leewolf/desktop/adt-bundle-mac-x86_64-20130522/sdk/tools/ant/build.xml:284: null returned: 2

Total time: 44 seconds
Error running command, return code: 1
我的最终解决方法: 不使用cocos的编译,使用eclipse运行就好

本人cocos2d新手, 这是对我来说最简单的方法, 没办法啦


好像还有一个办法, 是参加: http://my.oschina.net/vaero/blog/195734

首先,需要为cocos2dx在android平台的java lib代码,添加android library工程支持。

// 添加android library工程支持
android update lib-project -t android-13 -p .
然后,继续回到自己的cocos工程位置,为其添加android工程支持。
// 添加android工程支持
android update project -p . -t android-13
// 编译并安装(debug版)
ant debug install





你可能感兴趣的:(Android,cocos2d)