I have setup the react native project as mentioned in react-native documentation (https://facebook.github.io/react-native/docs/getting-started.html). On building using the command react-native run-android
, I am getting the following error.
Starting JS server... Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
Where: Build file '/var/www/html/react-native/NewProject/android/app/build.gradle' line: 1
What went wrong: A problem occurred evaluating project ':app'.
java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Development Environment
java version "1.8.0_121"
Android SDK
Android SDK Build Tools installed 23.0.1, 23.0.2
Could you please someone help me
At last figured out the problem
check $JAVA_HOME
Need JDK 1.8 to work
Install Java JDK 1.8 and change the JAVA_HOME
edit ~/.bashrc
and add JDK 1.8 path as JAVA_HOME
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre/
and source ~/.bashrc
close the current terminal window/tab and run
react-native run-android
in new tab (ensure $JAVA_HOME
set to jdk 1.8 before this)
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