Tutorial
Bug Info - version 63

Unsupported class file major version 63

🎉

Read This on Github

This article is available on Github. You can read it there and contribute to it.
Github Link
Any Issue ?

⭐ Understanding the Error

Explain This Bugs

BUILD FAILED in 1serror 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.
 
* What went wrong:
Could not open settings generic class cache for settings file 'F:\mains\ReactJS-For-Beginners\ReactNative 2023 (new)\00. Projects\2. Basic Template App\blogApp\android\settings.gradle' (C:\Users\maity\.gradle\caches\7.5.1\scripts\7f2bgt9wpkwmrzb6xn6aaghhf).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 63
 
* Try:
> 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.
 
* Get more help at https://help.gradle.org

This error is caused by the Gradle version. You can fix this by updating the Gradle version. Or another way is to downgrade the java version to 8.

📌 How to check the Gradle version?

According to the above link let's assume that you are using java 17 so you can use gradle 7.2 or above.

📌 How to install Gradle?

  1. You can install gradle(according to your java version) by downloading the zip file from here (opens in a new tab).

  1. Unzip the file and copy the folder to your desired location like C:\Gradle.

  2. Now add the path of the gradle folder to the environment variable PATH.

    • Configure your system environment variables by adding C:\Gradle\bin (or wherever you extracted Gradle) to your PATH variable.
    • To do this, go to Control Panel > System and Security > System > Advanced system settings > Environment Variables.
    • Under System variables, select Path and click Edit.
    • Click New and type C:\Gradle\bin.
    • Click OK to save the changes.

  1. Now check the gradle version by running the following command in your terminal.
gradle -v

You will get the following output.

------------------------------------------------------------
Gradle 8.0.2
------------------------------------------------------------
 
Build time:   2023-03-03 16:41:37 UTC
Revision:     7d6581558e226a580d91d399f7dfb9e3095c2b1d
 
Kotlin:       1.8.10
Groovy:       3.0.13
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          17.0.6 (Oracle Corporation 17.0.6+9-LTS-190)
OS:           Windows 11 10.0 amd64

📌 How to install Java 17?

  1. You can download the java 17 from here (opens in a new tab).

    • You can search on google for the latest version of java 17 and click on official website link.
    • Then click on the download button.

  2. Go to the C drive and open the Program Files folder and check the java folder and inside that folder you will find the jdk folder and inside that folder you will find the bin folder.

    • Copy the path of the bin folder

        C:\Program Files\Java\jdk-17\bin
  • Now add the path of the bin folder to the environment variable PATH.

    • To do this, go to Control Panel > System and Security > System > Advanced system settings > Environment Variables.
    • Under System variables, select Path and click Edit.
    • Click New and paste the path of the bin folder.
    • Click OK to save the changes.

  1. Now go to Environment Variables again and click on the New button and add the following variable.

    • Variable name: JAVA_HOME
    • Variable value: C:\Program Files\Java\jdk-17

  2. Now again go to Environment Variables and click on the system variables and find the variable named Path and click on the edit button and add the following path.

    • Click New and paste the path of the bin folder.
     C:\Program Files\Common Files\Oracle\Java\javapath

  3. Now check the java version by running the following command in your terminal.

    java -version

    You will get the following output.

    java version "17" 2021-09-14
    Java(TM) SE Runtime Environment (build 17+35-2724)
    Java HotSpot(TM) 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)

Now if you hit npx react-native run-android in your terminal it will work fine.