- Home /
Android build problem: Unable to convert classes Into a dex format
Hi everybody, i am stuck for days with a little problem that i can´t figure it out.
I buy a 2DAirHockey assets pack in the assets store for a project in my job and now i cant import the project to android. The manual only say i only have to change the write access to a extertal (sdcard) and have android sdk installed. But when i try to do it the process it´s stoped by the next message.
This is the error info in the console
CommandInvokationFailure: Unable to convert classes into dex format.
/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/chucho/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/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()
I don´t have much experience bulding games for android but thats the first time i have this problem and only happend in this project (i can build to android others project without any problems).
If anybody have any idea to how solve this it wiil be very helpuff. Thanks for reading and sorry for the bad english.
Answer by Elian20 · Aug 08, 2016 at 05:14 PM
Hi again, i solve the problem deleting all the plugins in the project. Because for this case i not need these plugins that way works for now. But if i need use them i don´t have idea what to do. Whatever, i hope my experience help others to solve their problems.
Answer by liortal · Sep 01, 2016 at 09:06 PM
CommandInvokationFailure: Unable to convert classes into dex format. /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/chucho/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -
stderr[ Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
From this error we can see that:
You are using JDK 1.7.0_79 (Java 1.7)
The Java tool that Unity executes as part of the build fails since it has encountered an unsupported class version.
Java classes have a version associated with them. Version 52.0 means a class that was compiled using a Java 1.8 compiler.
Your compiler is older than this version, and so it cannot process this class, which was compiled with a newer compiler. The easiest solution would be to install the latest version of JDK (JDK 8) which should fix this issue.