小编Luc*_*hin的帖子

Kotlin 多平台 Compose + 桌面 + Web + 移动

目前是否可以有一个使用 compose 的 kotlin 多平台项目来同时共享桌面、Web 和移动设备的 ui 代码?我发现的所有示例仅涵盖带有 JS Front + Jvm Backend 或 JVM Android + Desktop + Common Module 的多平台,并且我在同时使用所有这些设置项目时遇到了麻烦。

我尝试这样做:

plugins {
    kotlin("multiplatform")
    id("org.jetbrains.compose") version "1.0.1-rc2"
    id("com.android.library")
}
kotlin {
    android()
    jvm("desktop") {
       ...
    }
    js{
       ...
    }
    sourceSets {
        val commonMain by getting {
            dependencies {
               ...
            }
        }
        val commonTest by getting {
            dependencies {
               ...
            }
        }
        val androidMain by getting {
            dependencies {
                ...
            }
        }
        val androidTest by getting {
            dependencies { …
Run Code Online (Sandbox Code Playgroud)

kotlin-multiplatform android-jetpack-compose

8
推荐指数
2
解决办法
5655
查看次数