After merging my project with some changes from other developers I continue to get the following:
Error:Cause: com/android/build/gradle/internal/model/DefaultAndroidProject : Unsupported major.minor version 52.0
I've tried installing Java 8, and setting my project to use Java 8. If I change my JAVA_HOME to 1.8 on the command line and compile with gradle it works. If I try to use JAVA_HOME set to 1.7 and gradle it fails with the same error.
However, in Android Studio, no matter the JDK version, it continues to print that error.
Other developers are saying they are using Java 7 without issue. Other things I've tried:
gradle clean build
gradlew clean build
Reinstalling Android Studio
Another interesting symptom is that other projects in Android Studio are perfectly happy. It's just this project that has this problem.
Here are my environment settings:
OS: Mac OS X 10.9.5
Android Studio: 2.1.1
Android Studio JVM: 1.6
Project JVM: 1.7.0_75
Android SDK (Build Tools): 23.0.2
Gradle: 2.13
JAVA_HOME: /Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home
ANDROID_HOME: /Users/me/Library/Android/sdk
I suspect it has something to do with the gradle wrapper, but I can't figure out how to get graddle wrapper to reinitialize itself using 1.7.
The exact cause is printed on the version e.g. in the case of major. minor version 52.0, the class is compiled using JDK 8 since major version 52 corresponds to Java SE 8. This error can usually be fixed by running the application on the same (or higher) JRE version as the JDK.
minor version 52.0 comes when you are trying to run a class compiled using Java 1.8 compiler into a lower JRE version e.g. JRE 1.7 or JRE 1.6. Simplest way to fix this error is install the latest Java release i.e. Java 8 and run your program.
Try menu File - > Invalidate caches and restart
. Also make sure gradle plugins are latest:
classpath 'com.android.tools.build:gradle:2.1.0'
Set your JAVA_HOME to use jdk 1.8.
Also check your SDK location in Android Studio:
File->Other Settings->Default Project Structure->SDKs
This got me working on my MAC:
Goto>> File > Project Structure... > SDK Location (in left column) > JDK location section: Check
Use embedded JDK (recommended)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With