Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jetpack Compose and Android Room compatibility

I am trying to set up Android Room in my Jetpack Compose project. However, when trying to add...

kapt "androidx.room:room-compiler:2.2.3"

... to the app build.gradle dependencies. My build fails with the error...

e: java.lang.NoSuchMethodError: org.jetbrains.kotlin.codegen.state.GenerationState$Builder.isIrBackend(Z)Lorg/jetbrains/kotlin/codegen/state/GenerationState$Builder;

Any insight as to why this is? Can we use Android Room with Jetpack Compose yet?

like image 244
Michael Johnston Avatar asked Feb 13 '20 16:02

Michael Johnston


2 Answers

I'm pretty sure that we're still in a state where annotation processors (for Room, Retrofit, etc.) and the experimental Kotlin compiler are not getting along. The recommended approach at the moment is to isolate the Compose stuff in a module that is independent of modules that need annotation processors.

like image 71
CommonsWare Avatar answered Oct 13 '22 06:10

CommonsWare


This is currently not supported as kapt does not play well with Jetpack Compose. This issue is being tracked here - https://issuetracker.google.com/issues/143232368

like image 38
Vinay Gaba Avatar answered Oct 13 '22 08:10

Vinay Gaba