This guide provides detailed instructions for setting up the KMP Multi-Module Project Generator on your development environment, configuring it for your specific needs, and getting started with development across all supported platforms.
Before you begin, ensure your development environment meets the following requirements:
- Bash 4.0+: Required for running the project scripts
- Git: For version control and accessing the repository
- JDK 17: Required for Kotlin and Gradle
- Android Studio Electric Eel (2022.1.1) or newer: Recommended IDE for Android development
- Android SDK 33+: Latest Android platform APIs
- Android Build Tools 33.0.0+: Required for building Android applications
- macOS 13.0+: Required for iOS development
- Xcode 14.1+: Apple's IDE for iOS development
- CocoaPods 1.11.0+: Dependency manager for Swift and Objective-C projects
- Ruby 2.7+: Required for Fastlane and CocoaPods
- IntelliJ IDEA 2022.3+: Recommended IDE for desktop development (Community Edition is sufficient)
- Node.js 18.0+: Required for Kotlin/JS development
- npm 8.0+: Node.js package manager
- Fastlane 2.212.0+: For automated deployment workflows (required for CI/CD)
- GitHub CLI: For easier interaction with GitHub repositories
- Docker: For containerized development and testing
Follow these steps to set up your development environment:
git clone https://github.com/openMF/kmp-project-template.git
cd kmp-project-templateThe project includes a customization script that will update package names, application IDs, and other project identifiers to match your organization's naming conventions.
./customizer.sh org.example.myapp MyKMPProjectParameters:
- First parameter: Package name (e.g.,
org.example.myapp) - Second parameter: Project name (e.g.,
MyKMPProject)
Note: This branch is designed for partial customization. It doesn't rename application modules but changes all
coreandfeaturemodule namespaces and packages. For full customization, use thefull-customizablebranch.
The project uses Gradle's dependency management, so no additional steps are required.
# Validate Gradle setup
./gradlew tasksIf you're developing for iOS, you need to install CocoaPods dependencies:
cd cmp-ios
pod install
cd ..For web development, install Node.js dependencies:
cd cmp-web
npm install
cd ..If you plan to use CI/CD or need to manage keystores for Android app signing, configure the Secrets Manager:
./keystore-manager.sh generateThis will:
- Generate debug and release keystores for Android
- Update Gradle and Fastlane configurations
- Create a
secrets.envfile with keystore credentials
- Open Android Studio
- Select "Open an Existing Project"
- Navigate to and select the cloned project directory
- Wait for the Gradle sync to complete
- Configure an Android run configuration to test your setup
- Open the
cmp-ios/KmpProject.xcworkspacefile in Xcode - Select your development team in the project settings
- Configure an iOS simulator or device for testing
- Open IntelliJ IDEA
- Select "Open" and choose the cloned project directory
- Wait for the Gradle sync to complete
- Create a run configuration for the
cmp-desktopmodule
./gradlew build./gradlew cmp-android:installDebugOr use Android Studio's run button with a configured AVD (Android Virtual Device).
Open the Xcode workspace and run the project on a simulator or device.
Alternatively, use the command line:
cd cmp-ios
xcodebuild -workspace KmpProject.xcworkspace -scheme KmpProject -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14,OS=latest'./gradlew cmp-desktop:run./gradlew cmp-web:jsBrowserDevelopmentRunThis will start a development server and automatically open your default browser.
If you encounter Gradle build issues:
# Clean the build
./gradlew clean
# Refresh Gradle dependencies
./gradlew --refresh-dependencies buildEnsure your local.properties file contains the correct path to your Android SDK:
sdk.dir=/path/to/your/Android/sdk- Make sure CocoaPods is properly installed and the pods are up-to-date:
cd cmp-ios
pod repo update
pod install --repo-update- Check that Xcode command line tools are installed:
xcode-select --installIf you need to sync your fork with the upstream repository:
# Basic sync with the provided script
./sync-dirs.sh
# Sync with preview (dry run)
./sync-dirs.sh --dry-runOnce your environment is set up, you can:
- Explore the Architecture Overview to understand the project structure
- Review the Source Set Hierarchy to learn about code sharing
- Check the Code Style Guide for coding conventions
- Start developing your own features following the established patterns
To create a new feature module:
- Create a new directory in the
featurefolder - Add the module to
settings.gradle.kts - Configure build scripts following the existing modules
- Add the module to the
includedBuildin the root project
Manage dependencies using the version catalog in gradle/libs.versions.toml:
[versions]
# Add your library versions here
[libraries]
# Reference versions and define libraries
[plugins]
# Define Gradle pluginsThe project includes GitHub Actions workflows for CI/CD. Customize them in the .github/workflows directory to match your project's needs.
If you encounter any issues during setup, you can:
- Join the Slack channel for community support
- Report issues on GitHub
- Check the progress and plans on Jira