Roker
Roker

Reputation: 745

Can I write Jetpack Compose components in Java?

Is it possible to write Jetpack Compose components in Java? All of the documentation seems to only give examples in Kotlin. If not, is there any future plan to allow components to be implemented in Java?

Upvotes: 59

Views: 29689

Answers (1)

Ryan M
Ryan M

Reputation: 20119

No, you can't write Jetpack Compose components in Java, and there are no future plans to allow this (source: I work on Compose). Note that this is not the same thing as using components created in Compose from a Java app, which is possible.

Jetpack Compose makes heavy use of Kotlin features such as coroutines, and @Composable methods require transformations that are done by a Kotlin compiler plugin. There is no way to get access to these from Java.

Upvotes: 92

Related Questions