When running
react-native run-android
in my project folder, I get the following error:`
java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0
I've updated java to the latest version and made sure that I've got all the required build tool sdk versions installed:
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "myappId"
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
Unsupported major.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. Read more:...
If you are getting "java.lang.unsupportedclassversionerror HelloWorld unsupported major.minor version 52.0", which means Java version in your PATH is lesser than Java 8. If you already installed the JDK 1.8 then its due to incorrect PATH setting.
Make sure you have installed and targeting at least Android 6.0 Marshmellow and are using Android SDK Build-Tools 23.0.1. See React Native setup docs for more information.
Unsupported major.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.
I had the same problem. I resolved it as follow:
Make sure that you're using the new JDK (step 2).
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