BUG! exception in phase ‘semantic analysis’ in source unit ‘_BuildScript_’ Unsupported class file major version 61

Read Time:1 Minute, 21 Second


  • In Arch Linux, when try to execute npm run android, it throws the following error.

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 app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Could not open settings generic class cache for settings file '/srv/react-native/first-app/android/settings.gradle' (/home/chrislee/.gradle/caches/7.0.2/scripts/c3f08d7f60eavra0w0k1rfbn8).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61


  • Do not use Java 17 Open JDK as it’s not compatible at time of writing.
  • Check Gradle version
$ ./android/gradlew --version

Gradle 7.0.2

Build time:   2021-05-14 12:02:31 UTC
Revision:     1ef1b260d39daacbf9357f9d8594a8a743e2152e

Kotlin:       1.4.31
Groovy:       3.0.7
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          17 (Oracle Corporation 17+35)
OS:           Linux 5.14.15-arch1-1 amd64
$ sudo pacman -S jdk11-openjdk
  • Change Java version
$ sudo archlinux-java status
Available Java environments:
  java-17-openjdk (default)
$ sudo archlinux-java set java-11-openjdk
$ java -version
openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment (build 11.0.12+7)
OpenJDK 64-Bit Server VM (build 11.0.12+7, mixed mode)

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.