I try to use Jetpack Compose in my existing project the problem is if I include @Preview
annotation it doesn't show me anything, just this
There is my code
@Preview
@Composable
fun test() {
Text(text = "HELLO")
}
What am I missing here?
UPD
I assume this issue somehow related to that fact that I added Compose to existing project, as if I try to create the project from the scratch it works perfectly.
In addition I would like to add the error screenshot
Among adding these:
debugImplementation "androidx.compose.ui:ui-tooling:1.2.1"
implementation "androidx.compose.ui:ui-tooling-preview:1.2.1"
Add these too:
debugImplementation "androidx.customview:customview:1.2.0-alpha01"
debugImplementation "androidx.customview:customview-poolingcontainer:1.0.0"
Worked for me with Android Studio Chipmunk | 2021.2.1 Patch 2,
AGP 7.2.2,
ComposeCompiler 1.3.1,
Compose 1.2.1
[Source: https://issuetracker.google.com/issues/227767363#comment2]
Make sure you have the following dependencies in your project
debugImplementation "androidx.compose.ui:ui-tooling:1.2.1"
implementation "androidx.compose.ui:ui-tooling-preview:1.2.1"
Plus you are on the Android Gradle Plugin version that matches with the version of Android Studio you are using.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.