I am trying to configure jetpack compose for an ex...
# compose
v
I am trying to configure jetpack compose for an existing project. I have upgraded my Kotlin version to 2.0.0 and have completed the configuration following every single step in the official documentation: https://developer.android.com/develop/ui/compose/compiler I haven't done anything else other that what is indicated in the aforementioned documentation page. However, I still cannot import or use @Composable or any other jetpack compose features. Does this mean that I still need to go back to the main Jetpack compose page and list all the dependencies manually myself? (https://developer.android.com/develop/ui/compose/setup#setup-compose). That page is confusing because it states that it is recommended to follow the guide that I have provided in link #1, but it doesn't state up to which point?
s
Did you also add a dependency to something other than just the compiler plugin? Did you add the compose BOM and foundation or something like that?
v
Thank you for your reply. I haven't done any of that because the documentation includes a disclaimer above saying that if I use Kotlin 2.0.0 to just follow the link which does not include any of that. I am just not certain at this point how much that disclaimer includes:
s
Yeah configuring the compose compiler is one part, that enables you to write compose code in that module. However after that in order to get access to the Composable annotation https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]on%20Composable&ss=androidx%2Fplatform%2Fframeworks%2Fsupport I am pretty sure you also need to bring in the runtime artifact https://developer.android.com/jetpack/androidx/releases/compose-runtime#1.6.8 Smth like this inside your libs toml file
androidx-compose-runtime = { module = "androidx.compose.runtime:runtime" }
v
thank you Stylianos, I managed to get it to work by adding the dependencies listed on link 2
🌟 1
b
I will update this documentation, I agree that the way it is written is confusing
🌟 1