javaandroidgradleintellij-ideajetbrains-ide

How do I get jbr-21 in my Jellyfish Android Studio?


When trying to run my unit test in Android Studio, I get this error

java.lang.UnsupportedClassVersionError: com/example/module/SomeTests has been compiled by a more recent version of the Java Runtime (class file version 63.0), this version of the Java Runtime only recognizes class file versions up to 61.0

Version 61 is Java 17, Version 63 is Java 19. In my build.gradle.kts I have this:

sourceCompatibility = JavaVersion.VERSION_19
targetCompatibility = JavaVersion.VERSION_19

So I compile to Java 19. In Android Studio settings -> Build, Execution, Deployment -> Gradle I have only jbr-17, so Java 17: enter image description here I am also not offered to download a newer version: enter image description here

So, how can I get a newer jbr version in my Android Studio? According to https://github.com/JetBrains/JetBrainsRuntime?tab=readme-ov-file there is only jbr-17 and then directly jbr-21. However I am also not offered jbr-21. Guess that is because Android Studio Jellyfish is still based on Intelij 2023 and jbr-21 is only delivered with Intellij 2024? enter image description here But how can I fix that?


Solution

  • JetBrains Runtime (JBR) is a special version of JRE that is intended ONLY to be used as the runtime for IntelliJ IDEA itself. It should not be used as Project's or Gradle's JRE.

    You should download a regular JDK.