android 多模块应用程序与Kotlinkts -错误运行应用程序在模拟器(警告:默认脚本插件被禁用:)

rjjhvcjd  于 9个月前  发布在  Android
关注(0)|答案(2)|浏览(74)

每当我尝试运行我的第一个但很大的飞跃到Android开发和Kotlin与多模块应用程序类似的Android演示应用程序中的Now时,我都会面临下面的错误

warning: default scripting plugin is disabled: The provided plugin org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingCompilerConfigurationComponentRegistrar is not compatible with this version of compiler
error: unable to evaluate script, no scripting plugin loaded

字符串
我试过使用android studio iguana和hedgehog,但都出现了同样的错误。
对于我的第一个应用程序,我遵循了now in android应用程序的结构。
请帮助理解并解决上面的错误。
我的嘴唇.版本.toml [仅版本]

[versions]
accompanist = "0.32.0"
android-gradlePlugin = "8.1.4"
androidxCore = "1.12.0"
junit4 = "4.13.2"
androidx-test-ext-junit = "1.1.5"
espresso-core = "3.5.1"
lifecycle-runtime-ktx = "2.6.1"
activity-compose = "1.7.2"
androidxComposeBom = "2023.01.00"
androidDesugarJdkLibs = "2.0.3"
androidxAppCompat = "1.6.1"
androidxActivity = "1.8.0"
androidxBrowser = "1.6.0"
androidxComposeCompiler = "1.4.5"
androidxComposeMaterial3 = "1.1.0-alpha06"
androidxComposeRuntimeTracing = "1.0.0-alpha01"
androidxCoreSplashscreen = "1.0.1"
androidxDataStore = "1.0.0"
androidxEspresso = "3.5.1"
androidxLifecycle = "2.6.2"
androidxMacroBenchmark = "1.2.0-rc02"
androidxMetrics = "1.0.0-alpha04"
androidxNavigation = "2.7.4"
androidxProfileinstaller = "1.3.1"
androidxStartup = "1.1.1"
androidxTestCore = "1.5.0"
androidxTestExt = "1.1.5"
androidxTestRules = "1.5.0"
androidxTestRunner = "1.5.2"
androidxTracing = "1.1.0"
androidxUiAutomator = "2.2.0"
androidxWindowManager = "1.1.0"
androidxWork = "2.9.0-beta01"
coil = "2.4.0"
firebaseBom = "32.3.1"
firebaseCrashlyticsPlugin = "2.9.9"
firebasePerfPlugin = "1.4.2"
gmsPlugin = "4.4.0"
googleOss = "17.0.1"
googleOssPlugin = "0.10.6"
androidxHiltNavigationCompose = "1.0.0"
hilt = "2.44.2"
hiltExt = "1.0.0"
jacoco = "0.8.7"
kotlin = "1.8.20"
kotlinxCoroutines = "1.7.3"
kotlinxDatetime = "0.4.1"
kotlinxSerializationJson = "1.6.0"
ksp = "1.8.20-1.0.11"
lint = "31.1.2"
okhttp = "4.11.0"
protobuf = "3.24.4"
protobufPlugin = "0.9.4"
retrofit = "2.9.0"
retrofitKotlinxSerializationJson = "1.0.0"
room = "2.5.2"
secrets = "2.0.1"
turbine = "1.0.0"
ui-tooling = "1.4.3"
material = "1.9.0"
robolectric = "4.10.3"
roborazzi = "1.5.0"
paletteKtx = "1.0.0"
material3Android = "1.2.0-alpha12"


[bundles]


操作:从文件资源管理器中运行应用程序build.gradle.kts,
预期:成功构建后,应用程序应显示在模拟器中
实际:

warning: default scripting plugin is disabled: The provided plugin org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingCompilerConfigurationComponentRegistrar is not compatible with this version of compiler
error: unable to evaluate script, no scripting plugin loaded

nbysray5

nbysray51#

似乎没有启用对compose的支持。每个包含compose逻辑的模块都需要在模块build.gradle.kts配置中使用指定的编译器版本启用compose:

// Enable support for Compose.
buildFeatures {
    compose = true
}

// Specify the Compose compiler version.
composeOptions {
    kotlinCompilerExtensionVersion = libs.versions.androidxComposeCompiler.get()
}

字符串
因为你使用的是版本目录,所以在那里声明compose编译器版本是有意义的。我强烈建议更新依赖项的版本(包括Kotlin,ksp,hilt等等),除非你有特定的要求阻止你这样做。
截至撰写时:

  • 最新的(稳定的)compose编译器版本是1.5.6
  • 材料(BOM)的最新组成版本为2023.10.01

链接到官方发行说明:

[versions]

# ...

kotlin = "1.9.21"
ksp = "1.9.21-1.0.5"
hilt = "2.49"
hiltExt = "1.1.0"
room = "2.6.1"

# ...

androidxComposeBom = "2023.10.01"
androidxComposeCompiler = "1.5.6"

# ...


让我知道这是否解决了问题。

hxzsmxv2

hxzsmxv22#

我最终决定使用ide上的“运行”按钮。

相关问题