Hej! Im working with the Android side of a multipl...
# community-support
z
Hej! Im working with the Android side of a multiplatform project, and Ive been completely pwned by the build times. To the point that Im fairly certain that something is terribly wrong. • Compiling and running the desktop variant takes roughly 2 seconds on average. I dont have any data for this specifically, but its very quick. • When it comes to Android, Im seeing average build times of around 5 minutes and looking at a build scan I can see that some very small modules take a few minutes to compile. This tells me that something is at odds, but I dont really understand what that might be? More details in 🧵
For example, in the timeline view of a build scan I can see that: :navigator 3m 38.866s That module is just a shared module between many other modules. It has one object, and a sealed interface with ~50 classes. This is the involved
build.gradle.kts
file:
Copy code
plugins {
    alias(config.plugins.multiplatform.android)
    alias(config.plugins.multiplatform.jvm)
}

kotlin {
    sourceSets.commonMain.dependencies {
        api(config.aggregate.core)

        implementation(libs.coroutines)
    }
}
config.plugins.multiplatform.x
are convention plugins that I share between my projects, containing stuff like:
Copy code
configure<KotlinMultiplatformExtension> {
    applyDefaultHierarchyTemplate()

    compilerOptions {
        freeCompilerArgs.addAll(CompilerArgs)
    }
}
Copy code
val CompilerArgs =
    listOf(
        "-Xskip-prerelease-check",
        "-Xexpect-actual-classes",
        "-Xcontext-receivers",
        "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
    )
And
jvm() android()
etc. Im really clueless unfortunately, this project is even just a subset of the whole project - ironically to speed up build times when developing a subset of its features.
l
@Zoltan Demant, can you share the project source code so I can replicate it or can you create a Build Scan by any chance?
z
Thanks for the response @Laura Kassovic; I was able to solve the issue (I also posted this in the kotlin slack for multiplatform). Ill share the findings here in case it helps anyone else: Comment that šŸ’”: "does https://blog.jetbrains.com/kotlin/2022/06/introducing-kotlin-build-reports/ help narrow down what is slow within the kotlin compile?" ---- "Awesome, that helps a lot: No incremental compilation due to
kotlin.compiler.execution.strategy=in-process
(I added this yesterday after asking AI about the issues). One of my convention plugins for multiplatform adds (by mistake) android-library to every module its applied to. Ive been using this for a lot of projects, I think the extra time just grows exponentially due to this project being ridiculous in size. These two tweaks brought the build time down from 5 minutes to 5 seconds. "
šŸ™Œ 1