reactjsreact-nativebuildcreate-react-native-app

React native BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 64


npx react-native run-android info Starting JS server... info Launching emulator... info Successfully launched emulator. info Installing the app...

FAILURE: Build failed with an exception.

BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 64

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

BUILD FAILED in 6s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 64

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

BUILD FAILED in 6s

at makeError (C:\react native\New folder (2)\MyProject\node_modules\execa\index.js:174:9)
at C:\react native\New folder (2)\MyProject\node_modules\execa\index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (C:\react native\New folder (2)\MyProject\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:82:7)
at async Command.handleAction (C:\react native\New folder (2)\MyProject\node_modules\@react-native-community\cli\build\index.js:108:9)

info Run CLI with --verbose flag for more details.

npx react-native run-android info Starting JS server... info Launching emulator... info Successfully launched emulator. info Installing the app...

FAILURE: Build failed with an exception.

BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 64

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

BUILD FAILED in 6s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 64

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

BUILD FAILED in 6s

at makeError (C:\react native\New folder (2)\MyProject\node_modules\execa\index.js:174:9)
at C:\react native\New folder (2)\MyProject\node_modules\execa\index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (C:\react native\New folder (2)\MyProject\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:82:7)
at async Command.handleAction (C:\react native\New folder (2)\MyProject\node_modules\@react-native-community\cli\build\index.js:108:9)

info Run CLI with --verbose flag


Solution

  • You need to change you JDK version to 11, this will fix your problem and also dont forget to Uninstall you current JDK and install version 11 Java SE Development Kit 11.0.19 if you change these steps and still have a same problem, this mean your project is still using old jdk version so you have to build another React Native project

    register an account and login on oracle so you will be able to download JDK 11 : https://www.oracle.com/java/technologies/javase/jdk11-archive-downloads.html