Android 开发问题:Plugin [id: ‘org.jetbrains.kotlin.plugin.compose‘, ...] was not found

张开发
2026/4/17 14:31:34 15 分钟阅读

分享文章

Android 开发问题:Plugin [id: ‘org.jetbrains.kotlin.plugin.compose‘, ...] was not found
在 Android 开发中出现如下错误信息Build file D:\AndroidCode\MyCounter\build.gradle.kts line: 2 Plugin [id: org.jetbrains.kotlin.plugin.compose, version: 1.9.24, apply: false] was not found in any of the following sources: * Try: Run with --info or --debug option to get more log output. Run with --scan to get full insights. Get more help at https://help.gradle.org. * Exception is: org.gradle.api.plugins.UnknownPluginException: Plugin [id: org.jetbrains.kotlin.plugin.compose, version: 1.9.24, apply: false] was not found in any of the following sources: - Gradle Core Plugins (plugin is not in org.gradle namespace) - Included Builds (No included builds contain this plugin) - Plugin Repositories (could not resolve plugin artifact org.jetbrains.kotlin.plugin.compose:org.jetbrains.kotlin.plugin.compose.gradle.plugin:1.9.24) Searched in the following repositories: Google MavenRepo Gradle Central Plugin Repository at org.gradle.plugin.use.resolve.internal.PluginResolutionResult.getFound(PluginResolutionResult.java:112) at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.resolvePluginRequest(DefaultPluginRequestApplicator.java:192) at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugins(DefaultPluginRequestApplicator.java:97) at org.gradle.kotlin.dsl.provider.PluginRequestsHandler.handle(PluginRequestsHandler.kt:45) at org.gradle.kotlin.dsl.provider.StandardKotlinScriptEvaluator$InterpreterHost.applyPluginsTo(KotlinScriptEvaluator.kt:219) ...问题原因这个错误表示 Gradle 在配置的仓库中找不到指定的org.jetbrains.kotlin.plugin.compose插件可能是插件 ID 或版本号错误、未正确配置插件仓库、网络问题导致无法访问插件仓库等处理策略这里尝试其他策略无果只能选择修改版本号在libs.versions.toml文件中[versions] agp 8.7.3 kotlin 1.9.24 # 原来是这样 coreKtx 1.10.1 junit 4.13.2 junitVersion 1.1.5 espressoCore 3.5.1 appcompat 1.6.1 material 1.10.0 lifecycleRuntimeKtx 2.6.1 activityCompose 1.8.0 composeBom 2024.04.01 ...[versions] agp 8.7.3 kotlin 2.0.0 # 修改成这样 coreKtx 1.10.1 junit 4.13.2 junitVersion 1.1.5 espressoCore 3.5.1 appcompat 1.6.1 material 1.10.0 lifecycleRuntimeKtx 2.6.1 activityCompose 1.8.0 composeBom 2024.04.01 ...

更多文章