构建Player时出错:CommandInvokationFailure:无法将类转换为dex格式

时间:2015-02-01 08:06:00

标签: android build unity3d apk

请帮我解决这个问题。这是我在控制台中得到的:

Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.

C:\Program Files\Java\jdk1.8.0_25\bin\java.exe -Xmx1024M -Dcom.android.sdkmanager.toolsdir="D:/Android SDK/sdk\tools" -Dfile.encoding=UTF8 -jar "D:/Unity3D/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -

stderr[

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added:       Lcom/google/android/gms/internal/qn;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
at com.android.dx.command.dexer.Main.processClass(Main.java:732)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
at com.android.dx.command.dexer.Main.access$300(Main.java:83)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at SDKMain.main(SDKMain.java:130)
1 error; aborting
]
stdout[
processing archive bin\classes.jar...
processing com/unity3d/player/a$1.class...
processing

和一百万的处理事情......它花了320k线,所以我不能把它贴在这里。

2 个答案:

答案 0 :(得分:2)

插件通常会发生这种情况。在项目的资源管理器中搜索任何重复的jar。删除任何重复项。如果它没有解决您的问题,请尝试删除您的"插件"项目的文件夹,然后重新导入所有插件。希望它能够得到解决。

答案 1 :(得分:0)

我通过简单地从Open Unity更改java路径转到Edit - >解决了这个问题。偏好 - > JDK中的外部工具。 (这个jdk文件夹实际上是在系统上运行的。)