unity安卓打包报错Unable to convert dasses into dex format. See the Console for details.

0 投票
最新提问 10月 23, 2020 用户: shangze (130 分)

报错信息:

CommandInvokationFailure: Unable to convert classes into dex format.
C:/Program Files/Java/jdk1.8.0_121\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Program Files/Android_SDK\tools" -Dfile.encoding=UTF8 -jar "D:\unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

stderr[

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
 at com.android.dx.command.dexer.Main.processClass(Main.java:752)
 at com.android.dx.command.dexer.Main.processFileBytes(Main.java:718)
 at com.android.dx.command.dexer.Main.access$1200(Main.java:85)
 at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1645)
 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:672)
 at com.android.dx.command.dexer.Main.processAllFiles(Main.java:574)
 at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
 at com.android.dx.command.dexer.Main.run(Main.java:277)
 at com.android.dx.command.dexer.Main.main(Main.java:245)
 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:498)
 at SDKMain.main(SDKMain.java:130)
Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
 at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
 at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
 at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
 at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
 at com.android.dx.command.dexer.Main.parseClass(Main.java:764)
 at com.android.dx.command.dexer.Main.access$1500(Main.java:85)
 at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1684)
 at com.android.dx.command.dexer.Main.processClass(Main.java:749)
 ... 19 more
1 error; aborting
]

exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

网上查的解决方案是删重复的JAR包

或者路径错误

具体怎么解决

登录 或者 注册 后回答这个问题。

欢迎来到 EasyAR Q&A ,有什么不懂的可以尽管在这里提问,你将会收到社区其他成员的回答。
...