- Home /
unable to convert classes into dex format
I have looked at other questions from people with the same error but it seems like my error has a different cause, and the culprit seems to be unity ads. when I try to build for android, it fails and says "unable to convert classes into dex format, look at the console for more info". and in the console I have the following two errors:
CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details. C:\Program Files\Java\jdk1.7.0_79\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/Ashkan/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity 5.3.4\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
stderr[ Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:274) at SDKMain.main(SDKMain.java:127) ] stdout[
] 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) UnityEditor.HostView:OnGUI()
and the second error is :
Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details. C:\Program Files\Java\jdk1.7.0_79\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/Ashkan/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity 5.3.4\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
stderr[ Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:274) at SDKMain.main(SDKMain.java:127) ] stdout[
]
even when I start a new project with only the unity Ads enabled, I still get the same error when I build for android. I don't have a problem with iOS. only android. I have looked into those directories that the error points to but I really don't know what I am looking at there or why those directories cause a problem. I have tried it with both unity 5.3.4 and 5.3.5 to no avail. any help would be greatly appreciated.
I finally found another post that says if the problem is caused by unity ads, then you need to update your jdk to the latest version, in my case i updated my jdk to jdk 1.8.0_102 and the problem went away. and here is a link to that post: http://forum.unity3d.com/threads/unable-to-convert-classes-into-dex-format-need-help.416342/
Answer by $$anonymous$$ · Aug 07, 2016 at 03:14 PM
I finally found another post that says if the problem is caused by unity ads, then you need to update your jdk to the latest version, in my case i updated my jdk to jdk 1.8.0_102 and the problem went away. and here is a link to that post: http://forum.unity3d.com/threads/unable-to-convert-classes-into-dex-format-need-help.416342/
Your answer
Follow this Question
Related Questions
Unity GetPersistentManager().WriteFile Error 3 Answers
Redirect Unity unmanaged console 0 Answers
'Red' Errors in Console and Production of Garbage in Memory. 0 Answers
Request error (error): UnityEditor.AsyncHTTPClient:Done(State, Int32) 1 Answer
The console no longer takes you directly to the error in the script? 1 Answer