17

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"
    }
}
Djakninn
  • 227
  • 2
  • 9
  • Possible duplicate of [Unsupported major.minor version 52.0](https://stackoverflow.com/questions/22489398/unsupported-major-minor-version-52-0) – Chris Gomez Dec 28 '18 at 22:12

1 Answers1

15

I had the same problem. I resolved it as follow:

  1. Updated my JDK to 1.8
  2. Changed JAVA_HOME environment variable to point to the folder of new JDK version

Make sure that you're using the new JDK (step 2).

Jordan Enev
  • 16,904
  • 3
  • 42
  • 67
  • 4
    Thanks – more detail: On OS X (El Capitain), I just googled for install JDK 1.8 and I got a download page from Oracle. I then ran the command, `/usr/libexec/java_home` which gave me the value I needed for JAVA_HOME, which I added to my ~/.bash_profile – ABCD.ca Jan 24 '17 at 18:38
  • This work for me, did not have to change the JAVA_HOME. thanks for the good answer. I thought that it did not support JDK 1.8 as when you develop on Android or Xamarin it not work well with JDK 1.8 at the moment – Angel Mar 17 '17 at 18:56