Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: androidx/compose/compiler/plugins/kotlin/ComposeComponentRegistrar compiled with newer Java Runtime version

I'm encountering an issue while trying to build my Android project using AndroidX Compose. I'm getting the following error message:

androidx/compose/compiler/plugins/kotlin/ComposeComponentRegistrar has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

It seems that my current Java Runtime Environment (JRE) is outdated and does not support the class file version used by the AndroidX Compose library.

Environment details:

  • Java version: JDK 17
  • AndroidX Compose version: 1.4.5
  • Build system: Gradle 8.1
  • Kotlin: 1.8.20
./gradlew  -version | grep JVM

output: JVM: 17.0.6 (JetBrains s.r.o. 17.0.6+10-b802.4)

Based on note from here JDK 17 must work.

I would like to know the best way to resolve this issue. Should I update my JDK and JRE to a more recent version, or is there a way to use a compatible version of the AndroidX Compose library with my current JDK?

Any help or suggestions would be appreciated. Thanks!

like image 790
moallemi Avatar asked Dec 04 '25 14:12

moallemi


2 Answers

Check the NOTE here: Compose Compiler | Jetpack | Android Developers

screenshot of above web page

So, if not using Java 17+ stick to Compose Compiler 1.4.4 & wait till 1.4.6 release for older Java version support.

like image 99
Pratik Jethva Avatar answered Dec 07 '25 04:12

Pratik Jethva


Just use previous version of Compose (1.4.4) and Kotlin (1.8.10)

like image 42
Vitalii Cherniak Avatar answered Dec 07 '25 04:12

Vitalii Cherniak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!