Sunday, 3 September 2017

java - Android gradle error unsupportedclassversionerror

I'm trying to make my first app (hello world) and run it on my phone, but when I click run, gradle returns this error(i researched here on stackoverflow and tried to turn off instant run but it doesn't seem to work in my case):



AGPBI: {"kind":"error","text":"java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.defineClass1(Native Method)","sources":[{}]}
AGPBI: {"kind":"error","text":"java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.defineClass(ClassLoader.java:800)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.defineClass1(Native Method)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.defineClass(ClassLoader.java:800)","sources":[{}]}

AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.defineClass(URLClassLoader.java:449)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.access$100(URLClassLoader.java:71)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.defineClass(URLClassLoader.java:449)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader$1.run(URLClassLoader.java:361)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.access$100(URLClassLoader.java:71)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader$1.run(URLClassLoader.java:355)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.security.AccessController.doPrivileged(Native Method)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.findClass(URLClassLoader.java:354)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.loadClass(ClassLoader.java:425)","sources":[{}]}

AGPBI: {"kind":"error","text":"\tat sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.loadClass(ClassLoader.java:358)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)","sources":[{}]}
AGPBI: {"kind":"error","text":"Exception in thread \"main\" ","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader$1.run(URLClassLoader.java:361)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader$1.run(URLClassLoader.java:355)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.security.AccessController.doPrivileged(Native Method)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.findClass(URLClassLoader.java:354)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.loadClass(ClassLoader.java:425)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)","sources":[{}]}

AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.loadClass(ClassLoader.java:358)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)","sources":[{}]}
AGPBI: {"kind":"error","text":"Exception in thread \"main\" ","sources":[{}]}

:app:transformClassesWithDexForDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
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

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 55.085 secs

AGPBI: {"kind":"error","text":"java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0","sources":[{}]}

AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.defineClass1(Native Method)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.defineClass(ClassLoader.java:800)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.defineClass(URLClassLoader.java:449)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.access$100(URLClassLoader.java:71)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader$1.run(URLClassLoader.java:361)","sources":[{}]}
AGPBI: {"kind":"error","text":"java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader$1.run(URLClassLoader.java:355)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.defineClass1(Native Method)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.security.AccessController.doPrivileged(Native Method)","sources":[{}]}

AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.defineClass(ClassLoader.java:800)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.findClass(URLClassLoader.java:354)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.loadClass(ClassLoader.java:425)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.defineClass(URLClassLoader.java:449)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.access$100(URLClassLoader.java:71)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader$1.run(URLClassLoader.java:361)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader$1.run(URLClassLoader.java:355)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.security.AccessController.doPrivileged(Native Method)","sources":[{}]}

AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.findClass(URLClassLoader.java:354)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.loadClass(ClassLoader.java:425)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.loadClass(ClassLoader.java:358)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)","sources":[{}]}
AGPBI: {"kind":"error","text":"Exception in thread \"main\" ","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.loadClass(ClassLoader.java:358)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)","sources":[{}]}
AGPBI: {"kind":"error","text":"Exception in thread \"main\" ","sources":[{}]}'



later edit: i figured it has something to do with the java version, but i don't know how to update my android studio?



later edit2: i figured it out, i had an older jdk version installed on my computer and the latest android studio, thanks for the help. I just had to install the newest jdk version(8)

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...