Huge thanks to Gabriele Mariotti for pointing us towards the extended icons library in his answer. I would like to post another answer to share how to pull the same thing off if you're managing your dependencies and building your app with Gradle the newer way.
If:
Your app module's build script is written in Gradle Kotlin DSL in app/build.gradle.kts
;
Your dependencies versions are maintained in a version catalog in gradle/libs.versions.toml
;
Your Compose libraries dependencies are versioned using the Compose BOM (compose-bom
);
then I suggest you depend on Compose Material Icons Extended like this:
- Add this to the
[libraries]
section of your gradle/libs.versions.toml
:
material-icons-extended = { group = "androidx.compose.material", name = "material-icons-extended" }
- Add this to the
dependencies
scope in your app/build.gradle.kts
:
implementation(libs.material.icons.extended)
- Sync your project with your Gradle build files.
Now you should be able to use all your favourite Material Icons in your app importing them like this:
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Fastfood
// ...
Icon(
imageVector = Icons.Outlined.Fastfood,
contentDescription = "Burger and Soda",
)