Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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.

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

What am I missing for the import to work?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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"
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading