How to add a module in Multi-Module App in Kotlin Multiplatform(KMP/CMP)?

To add a module to a multi-module KMP or CMP, follow these steps.
Note: Update gradle files according to your requirements.

1- Add a folder in the directory e.g “auth”

2-Update Settings.gradle.kts at the end of bottominclude(“feature:auth”)
    Press “Sync Now”
3-Add “build.gradle.kts” file in the created module directory

Update baseName = “NewName”

Update namespace = “”
4-Update build.gradle.kts

5- add a new directory in a created module like the following for “commonMain

src/commonMain/kotlin

5-A. You can also add for androidMain and iOSMain as well inside src directory

6- Add another directory with something like the following

com.example.demo.feature.auth

Leave a Reply

Your email address will not be published. Required fields are marked *