目录

解决Error resolving plugin xxx

问题信息

复制代码
Error resolving plugin [id: 'com.android.library', version: '8.6.0']
> The request for this plugin could not be satisfied because the plugin is already on the classpath with an unknown version, so compatibility cannot be checked.

* 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.GradleException: Error resolving plugin [id: 'com.android.library', version: '8.6.0']
    at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.resolvePluginRequest(DefaultPluginRequestApplicator.java:188)
    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:212)
    at org.gradle.kotlin.dsl.execution.Interpreter$ProgramHost.applyPluginsTo(Interpreter.kt:385)
    at Program.execute(Unknown Source)

问题原因

在module中使用了未在项目根目录下build.gradle中声明的插件,比如这里的'com.android.library'插件。

解决方法

在项目根目录下的build.gradle中声明此插件即可,如下:

Kotlin 复制代码
plugins {
    alias(libs.plugins.android.application) apply false
    alias(libs.plugins.kotlin.android) apply false
    alias(libs.plugins.jetbrains.kotlin.jvm) apply false
    alias(libs.plugins.android.library) apply false //这里声明了此插件
}
本文是转载文章,点击查看原文
如有侵权,请联系 xyy@jishuzhan.net 删除
相关推荐
tangweiguo030519872 小时前
打破界限:Android XML与Jetpack Compose深度互操作指南
android·kotlin·compose
派小汤4 小时前
The emulator process for AVD xxx has terminated
安卓·android-studio
前行的小黑炭6 小时前
设计模式:为什么使用模板设计模式(不相同的步骤进行抽取,使用不同的子类实现)减少重复代码,让代码更好维护。
android·java·kotlin
QING61810 小时前
Kotlin Delegates.notNull用法及代码示例
android·kotlin·源码阅读
QING61810 小时前
Kotlin filterNot用法及代码示例
android·kotlin·源码阅读
自动花钱机1 天前
Kotlin问题汇总
android·开发语言·kotlin
前行的小黑炭1 天前
Android从传统的XML转到Compose的变化:mutableStateOf、MutableStateFlow;有的使用by有的使用by remember
android·kotlin
QING6181 天前
Kotlin Random.Default用法及代码示例
android·kotlin·源码阅读
QING6181 天前
Kotlin Byte.inc用法及代码示例
android·kotlin·源码阅读
QING6181 天前
Kotlin contentEquals用法及代码示例
android·kotlin·源码阅读