- Java 17 (should be specified in JAVA_HOME)
- [macOs/Linux] Android SDK downloaded via
./jbdeps/android-sdk/downloadAndroidSdk
- [Windows] Android SDK downloaded from Android Studio and specified in ANDROID_SDK_ROOT
- Download Android Studio from the official site (it is mandatory to use the version, written here). As an alternative you can use IDEA, which is compatible with this AGP version, or you can disable Android plugin in IDEA plugins, to develop non-Android targets.
- [macOs/Linux] Download Android SDK via
./jbdeps/android-sdk/downloadAndroidSdk
- [Windows] Download Android SDK via Android Studio and specify it in ANDROID_SDK_ROOT environment variable. Components, their versions and folder structure should be the same as in downloaded via script
./jbdeps/android-sdk/downloadAndroidSdk
SDK for other platforms. - Specify Gradle JVM to use JDK 17 in InteliJ IDEA Preferences (
Build, Execution, Deployment -> Build Tools -> Gradle
)
Run tests for Desktop:
./gradlew desktopTest
Run tests for Web:
./gradlew :mpp:testWeb
Run tests for UIKit:
./gradlew :mpp:testUIKit -PiosSimulatorName='iPhone 15'
Compose Multiplatform stores all public API in *.api files. If any API is added/changed, ./gradlew checkDesktop
will fail with an error that API is changed (it runs on CI). Example:
Execution failed for task ':compose:material3:material3:desktopApiCheck'.
> API check failed for project material3.
--- D:\Work\compose-multiplatform-core\compose\material3\material3\api\desktop\material3.api
+++ D:\Work\compose-multiplatform-core\out\androidx\compose\material3\material3\build\api\desktop\material3.api
@@ -552,6 +552,11 @@
public abstract interface annotation class androidx/compose/material3/ExperimentalMaterial3Api : java/lang/annotation/Annotation {
}
+public final class androidx/compose/material3/FF {
+ public static final field $stable I
+ public fun <init> ()V
+}
+
public final class androidx/compose/material3/FabPosition {
public static final field Companion Landroidx/compose/material3/FabPosition$Companion;
public static final synthetic fun box-impl (I)Landroidx/compose/material3/FabPosition;
You can run :material3:apiDump task to overwrite API declarations
To fix this error:
- Run
./gradlew desktopApiDump
- See what has changed in *.api files.
- If there are only additions - there is no binary incompatible change.
- If there are some removals - most probably there is a binary incompatible change and it needs to be fixed before merging it to the main branch.
Note that only desktop has API checks at the moment, but in the future it will be added for all targets.
Compose Multiplatform core libraries can be published to local Maven with the following steps:
- Use these gradle properties to set the published libraries versions
-Pjetbrains.publication.version.CORE_BUNDLE
,
-Pjetbrains.publication.version.CORE_URI
,
-Pjetbrains.publication.version.COMPOSE
,
-Pjetbrains.publication.version.COMPOSE_MATERIAL3_ADAPTIVE
,
-Pjetbrains.publication.version.LIFECYCLE
,
-Pjetbrains.publication.version.NAVIGATION
,
-Pjetbrains.publication.version.SAVEDSTATE
,
-Pjetbrains.publication.version.WINDOW
,
The default value for the version is 0.0.0-SNAPSHOT
And library groups:
-Pjetbrains.publication.libraries=CORE_BUNDLE,CORE_URI,COMPOSE,COMPOSE_MATERIAL3_ADAPTIVE,LIFECYCLE,NAVIGATION,SAVEDSTATE,WINDOW
The default value includes all libraries.
- Publish core libraries
./gradlew :mpp:publishComposeJbToMavenLocal -Pcompose.platforms=all -Pjetbrains.publication.version.COMPOSE=0.1.0-dev1000 -Pjetbrains.publication.version.LIFECYCLE=0.1.0-dev1000
-Pcompose.platforms=all
could be replace with comma-separated list of platforms, such as js,jvm,androidDebug,androidRelease,macosx64,uikit
.
- Publish extended icons
./gradlew :mpp:publishComposeJbExtendedIconsToMavenLocal -Pcompose.platforms=all --max-workers=1
- (Optional) Publish Gradle plugin using instructions to check changes locally.
Run jvm desktop samples:
./gradlew :compose:mpp:demo:runDesktop
./gradlew :compose:desktop:desktop:desktop-samples:run1
./gradlew :compose:desktop:desktop:desktop-samples:run2
./gradlew :compose:desktop:desktop:desktop-samples:run3
./gradlew :compose:desktop:desktop:desktop-samples:runSwing
./gradlew :compose:desktop:desktop:desktop-samples:runWindowApi
./gradlew :compose:desktop:desktop:desktop-samples:runVsync
./gradlew :compose:desktop:desktop:desktop-samples:runLayout
./gradlew :compose:desktop:desktop:desktop-samples-material3:runScaffold
Run wasm sample:
./gradlew :compose:mpp:demo:jsRun
Run native macos X64 sample:
./gradlew :compose:mpp:demo:runDebugExecutableMacosX64
Run native macos Arm64 sample:
./gradlew :compose:mpp:demo:runDebugExecutableMacosArm64
- To use a locally built compose in KMP with Compose wizard project you need to perform some extra steps:-Checkout https://github.com/JetBrains/compose-multiplatform
- Open
gradle-plugins
incompose-multiplatform
- Update
gradle.properties
by settingcompose.version
anddeploy.version
to the version you've published (0.1.0-dev1000
in example above). - Run
./gradlew publishToMavenLocal
- Open
components
incompose-multiplatform
- Update
gradle.properties
by settingcompose.useMavenLocal
totrue
andcompose.version
to the version you've published. - Run
./gradlew publishToMavenLocal
- Open KMP wizard project.
- Update
settings.gradle.kts
by addingmavenLocal()
to the end of bothrepositories
blocks. - Update
gradle/libs.versions.toml
by settingcompose-plugin
to the version you've published. - Sync gradle, now the project will build with the locally published Compose.
- Install plugin Kotlin Multiplatform Mobile for AppCode
- Disable Android Plugin in IDE preferences
- Open root of repository with AppCode
- Increase AppCode IDE memory more that 10GB
- Restart AppCode
- Wait while project synchronization with Gradle
- [Optional] To run on real iOS device
- Device should be at least with iOS 16.5. And Xcode should be at least 14.3
- Find your TEAM_ID with instruction https://github.com/JetBrains/compose-multiplatform-template#running-on-a-real-ios-device
- Create file project.properties in the root of repository. Add property
TEAM_ID=[your team id]
without double quotes, for exampleTEAM_ID=ABC123ABC1
.
- Choose run configuration iOS App
Run script:
./compose/mpp/demo/regenerate_xcode_project.sh
Wait while Xcode is opening, and press run button.
- Close project
-
./cleanTempFiles.sh