The KMP App Icon Generator Plugin is a Gradle plugin designed to simplify and automate the management of app icon resources across Android and iOS platforms in Kotlin Multiplatform (KMP) projects. This plugin ensures consistent handling of icons for different platforms, streamlining your development process.
- Cross-Platform Compatibility: Automatically configures and manages app icons for both Android and iOS platforms.
- Integration with Compose Resources: Supports
composeResources
for centralized image management within KMP projects. - Automatic Updates: Automatically updates and syncs app icons whenever changes are made.
- Foreground and Round Icons: Generates both
ic_launcher_foreground
andic_launcher_round
icons for Android.
To use the KMP App Icon Generator Plugin in your project, add the following to your build.gradle.kts
file:
plugins {
id("io.github.qamarelsafadi.kmp.app.icon.generator") version "1.2.6"
}
Ensure that your project is using a compatible version of Kotlin and Gradle:
- Kotlin version:
1.9.0
- Gradle version:
8.0+
For the plugin to function correctly, you must place your base icon image as icon.png
or icon.svg
in the following directory exactly as specified:
my-kmp-project/
├── composeApp/
│ └── src/
│ └── commonMain/
│ └── composeResources/
│ └── drawable/
│ └── icon.png
| or
| └── icon.svg
drawable/
: Ensure that your file is namedicon.png
oricon.svg
and placed in this directory. This file will be used to generate all necessary app icon resources.
The plugin provides the following task:
generateIcons
: Processes and generates icons for all configured platforms.
JUST RUN YOUR ANDROID OR IOS APP AND THE TASK WILL RUN AUTOMATICALLY!
or
Once configured, the plugin will automatically handle the generation and placement of app icons for both Android and iOS. To execute the plugin tasks, run:
./gradlew generateIcons
This will process the icon.png
file and generate:
ic_launcher_foreground.png
ic_launcher_round.png
for Android- Necessary icons for iOS within
Assets.xcassets
The plugin can be extended or customized to fit the specific needs of your project. For example, you can integrate it with custom tasks or modify the icon generation logic by overriding the default configurations.
Contributions are welcome! If you have suggestions for improvements or find a bug, please create an issue or submit a pull request.
This plugin is released under the Apache License. See the LICENSE file for details.