pretty

Sunday, 23 June 2024

Kotlin Multiplatform Wizard: problems building the project in the Xcode 15.4

The sample iOS project from Kotlin Multiplatform Wizard may fail to be built in XCode 15.4. The following steps should help to resolve these.

1. Add task("testClasses") to KotlinProject/shared/build.gradle.kts, inside the kotlin block:

kotlin {
    task("testClasses")
...
}


2. If XCode cannot build the project due to pointing to Java 11, showing an error: Android Gradle plugin requires Java 17 to run. You are currently using Java 11 - put the path to Java 17 to KotlinProject/gradle.properties:

org.gradle.java.home=/Applications/Android Studio.app/Contents/jbr/Contents/Home

This path depends on Android Studio ans OS version. The above is the path used in Android Studio Jellyfish on MacOS.