After importing unity ads package builder shows Unable to convert into dex format error

Hi.
Unity is showing 2 very similar errors in one time after adding unity ads. It is showing on building. Even if it is empty project with only ads.
I was trying to find duplicated files, but i haven’t found any duplicates. Forum solves of this problem don’t work for me. I tried to use all of this which I found.
I am trying to solve this problem for really lot of time like 20 hours, but it doesn’t work still.
First error:
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/andrzej/AppData/Local/Android/sdk\tools” -Dfile.encoding=UTF8 -jar “C:\Program Files\Unity\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)

Second error:
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/andrzej/AppData/Local/Android/sdk\tools” -Dfile.encoding=UTF8 -jar “C:\Program Files\Unity\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[

]

Best Regards.

My only guess is that whatever API corresponds to Android 5.1 is needed minimum, have no idea otherwise what the problem is… If you haven’t upgraded your android SDK lately, now’s a good time to do so.

You are using Java 1.7:

But the classes that are attempted to be parsed were compiled using a higher version compiler:

Major.minor version 52.0 means Java 8.

You should install the latest JDK 8 and point Unity to use that. This should be fix your issue.

Huh, so it was the Java version… maybe Unity should update their minimum requirements with the required JDK version, unless it’s already there…

It’s not a requirement - you may use all sorts of plugins, also ones that are compatible with the current Java installation you have.

They can probably add a recommendation to always use the latest version of the JDK or something similar.

Good idea, maybe even a warning that lower version JDKs might stuff things up with newer version binaries.

1 Like