Unsupported major.minor version 52.0 when rendering in Android Studio
This is bug in Android Studio.
Usually you get error: Unsupported major.minor version 52.0
WORKAROUND: If you have installed Android N, change Android rendering version with older one and the problem will disappear.
SOLUTION: Install Android SDK Tools 25.1.3 (tools) or higher
Android Studio continues to get a Unsupported major.minor version 52.0
Try menu File - > Invalidate caches and restart
. Also make sure gradle plugins are latest:
classpath 'com.android.tools.build:gradle:2.1.0'
Unsupported major.minor version 52.0 Visual Studio
TL;DR: You're using the wrong JDK version.
Full answer:
The issue is because of Java version mismatch.
Referring to the Wikipedia Java Class Reference :
J2SE 8 = 52
J2SE 7 = 51
J2SE 6.0 = 50
J2SE 5.0 = 49
JDK 1.4 = 48
JDK 1.3 = 47
JDK 1.2 = 46
JDK 1.1 = 45
These are the reported major numbers. The error regarding the unsupported major.minor version is because during compile time you are using a higher JDK and a lower JDK during runtime.
Thus, the 'major.minor version 52.0' error is possibly because the jar is compiled in jdk 1.8, but you are trying to run it in jdk 1.7 environment. To solve this, it's always better to have the jdk and jre pointed to the same version.
References
https://en.wikipedia.org/wiki/Java_class_file#General_layout
Unsupported major.minor version 52.0
gradlew/Android Studio - Unsupported major.minor version 52.0
I updated the java in /usr/bin/java from: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
and it builds now.
Unsupported major.minor version 52.0 in commande
I think you need to update the JAVA_HOME environment variable to the JDK8 installation directory. Make sure the PATH environment variable points to the same directory too (in this case remember to add a final "/bin" to the path).
If you see this answer, you will note that 52 means it needs Java SE 8 or superior.
Android Studio render preview error : Unsupported major.minor version 52.0
If you have problem in Android Studio and you have installed Android N, change Android rendering version with older one and the problem will disappear.
Gradle version issue (Unsupported major.minor version 52.0) on Ubuntu 16.04 with Android studio 2.2.2
Got it work Thanks.
I installed both java 1.7 and 1.8 and I was using 1.7 in the terminal by using sudo update-alternatives --config javac
. By some reason, I believe the android uses java 1.8. I changed update-alternatives option to java 1.8. The command 'gradlew tasks' starting to work as expected.
Related Topics
Install Shows Error in Console: Install Failed Conflicting Provider
Getting Bitmap from Vector Drawable
Android: Binding Data from a Database to a Checkbox in a Listview
Android 5.0 Android:Elevation Works for View, But Not Button
Loading Existing .HTML File with Android Webview
Custom Facebook Login Button - Android
Schedule a Work on a Specific Time with Workmanager
How to Make a Gridlayout Fit Screen Size
Android Background Image Size in Pixel
Filtering Listview with Custom (Object) Adapter
The APK File Does Not Exist on Disk
How to Handle Imeoptions' Done Button Click
How to Hide an Item from Recycler View on a Particular Condition
Listview Subobject Clickable Confilct
Manifest Merger Failed:Attribute Application@Appcomponentfactory - Androidx
How to Convert Dp, Px, Sp Among Each Other, Especially Dp and Sp