Import Jetpack Compose Card component not importing

I just created a new project with the below dependencies for material 3.

implementation "androidx.compose.material3:material3:1.0.0-alpha01"

I am not being able to import the Card component.

        modifier = Modifier.padding(16.dp),
        elevation = 4.dp,
        backgroundColor = Color.White
    ) {
            modifier = Modifier.padding(16.dp)
        ) {
            Text(text = "Hello, World!")
            Text(text = "This is a card")

What am I missing for the import to work?

>Solution :

I remember I had such problem before, it was that because version 1.0.0-alpha01 of androidx.compose.material3:material3 didn’t introduce Card composable yet, it was an early alpha version.
That is resolved in higher versions, try updating it to the latest stable version 1.0.1, you should be able to import the Card composable then. So you should have your implementation like this:

implementation "androidx.compose.material3:material3:1.0.1"

Leave a Reply