KMM项目shared模块出现"Kotlin not configured"警告的排查求助
问题描述
使用Kotlin Multiplatform Mobile(KMM)搭建项目时,shared模块的commonMain目录下的Kotlin文件显示"Kotlin not configured"警告,需排查问题根源。
相关配置及环境信息
项目根目录Build.gradle.kts
plugins { //trick: for the same plugin versions in all sub-modules alias(libs.plugins.androidApplication).apply(false) alias(libs.plugins.androidLibrary).apply(false) alias(libs.plugins.kotlinAndroid).apply(false) alias(libs.plugins.kotlinMultiplatform).apply(false) alias(libs.plugins.kotlinCocoapods).apply(false) }
Shared模块build.gradle.kts
plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.kotlinCocoapods) alias(libs.plugins.androidLibrary) } kotlin { androidTarget { compilations.all { kotlinOptions { jvmTarget = "1.8" } } } iosX64() iosArm64() iosSimulatorArm64() cocoapods { summary = "Some description for the Shared Module" homepage = "Link to the Shared Module homepage" version = "1.0" ios.deploymentTarget = "16.0" podfile = project.file("../iosApp/Podfile") framework { baseName = "shared" isStatic = true } } sourceSets { commonMain.dependencies { } commonTest.dependencies { implementation(libs.kotlin.test) } } } android { namespace = "com.devjeong.watermelon_player" compileSdk = 34 defaultConfig { minSdk = 24 } } dependencies { implementation("androidx.core:core-ktx:+") }
libs.version.toml配置

shared.src.commonMain.Platform.kt文件

环境版本信息
- Android Studio版本:Giraffe 2022.3.1 patch 4
- Gradle版本:8.1.3
- Kotlin版本:1.9.20
内容的提问来源于stack exchange,提问作者LineSmile
相关产品推荐
相关产品推荐

