Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Zandre Alberts
Zandre Alberts
2,613 Points

Android studio Gradle build error

I just started an app and I get this error:

Error:java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 Error: at java.lang.ClassLoader.defineClass1(Native Method) Error:java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 Error: at java.lang.ClassLoader.defineClass1(Native Method) Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800) Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:355) Error: at java.security.AccessController.doPrivileged(Native Method) Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425) Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) Error:java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 Error:java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 Error: at java.lang.ClassLoader.defineClass1(Native Method) Error: at java.lang.ClassLoader.defineClass1(Native Method) Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800) Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:355) Error: at java.security.AccessController.doPrivileged(Native Method) Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425) Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358) Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) Error:Exception in thread "main" Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358) Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) Error:Exception in thread "main" Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800) Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:355) Error: at java.security.AccessController.doPrivileged(Native Method) Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425) Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358) Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) Error:Exception in thread "main" Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800) Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:355) Error: at java.security.AccessController.doPrivileged(Native Method) Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425) Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358) Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) Error:Exception in thread "main" :app:transformClassesWithDexForDebug FAILED Error:Execution failed for task ':app:transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1 Information:BUILD FAILED Information:Total time: 23.746 secs Error:java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 Error: at java.lang.ClassLoader.defineClass1(Native Method) Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800) Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:355) Error: at java.security.AccessController.doPrivileged(Native Method) Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425) Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358) Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) Error:Exception in thread "main" Error:java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 Error: at java.lang.ClassLoader.defineClass1(Native Method) Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800) Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:355) Error: at java.security.AccessController.doPrivileged(Native Method) Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425) Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358) Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) Error:Exception in thread "main" Error:java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 Error: at java.lang.ClassLoader.defineClass1(Native Method) Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800) Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:355) Error: at java.security.AccessController.doPrivileged(Native Method) Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425) Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358) Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) Error:Exception in thread "main" Error:java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 Error: at java.lang.ClassLoader.defineClass1(Native Method) Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800) Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:355) Error: at java.security.AccessController.doPrivileged(Native Method) Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425) Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358) Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) Error:Exception in thread "main" Error:java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 Error: at java.lang.ClassLoader.defineClass1(Native Method) Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800) Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:355) Error: at java.security.AccessController.doPrivileged(Native Method) Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425) Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358) Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) Error:Exception in thread "main" Error:java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 Error: at java.lang.ClassLoader.defineClass1(Native Method) Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800) Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:355) Error: at java.security.AccessController.doPrivileged(Native Method) Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425) Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358) Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) Error:Exception in thread "main" Error:java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 Error: at java.lang.ClassLoader.defineClass1(Native Method) Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800) Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:355) Error: at java.security.AccessController.doPrivileged(Native Method) Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425) Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358) Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) Error:Exception in thread "main" Error:java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 Error: at java.lang.ClassLoader.defineClass1(Native Method) Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800) Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:355) Error: at java.security.AccessController.doPrivileged(Native Method) Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425) Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358) Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) Error:Exception in thread "main" Information:181 errors Information:0 warnings Information:See complete output in console

2 Answers

Seth Kroger
Seth Kroger
56,413 Points

The build tools require Java 8 but gradle is running under Java 7. Make sure you have a Java 8 SDK installed. If not download/install it: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html Then go to File> Project Settings in the menu (also the folder icon with 3 blue squares up top) and select SDK Location of the left s Switch the JDK over. (There's a new option on that panel "Use embedded JDK (recommended)". You can try checking it first to see if that solves the issue. I just haven't had the opportunity to try it yet.)

Zandre Alberts
Zandre Alberts
2,613 Points

Thanks got it and it works