Android Studio: Plugin with id 'com.android.library' not found

导入第三方jar 源码时,经常会报下面错误:

Plugin with id 'com.android.library' not found

这是由于创建jar 源码时的 gradle 版本和你本地 studio gradle版本不一致导致。

最简单做法:

1.新建一个项目

2.打开最外层 build.gradle

3.拷贝下面代码

buildscript {

repositories {
google()
jcenter()
}
dependencies {
// 这个和个人studio 配置有关根据情况改变
classpath 'com.android.tools.build:gradle:3.2.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

AI写代码
html

4.将拷贝的代码复制到新导入的jar 源码最外层 build.gradle 中(放置最下面即可)

5.执行 sync now

原文 https://blog.csdn.net/hj_key/article/details/89944549

posted @ 2025-11-03 17:13  jiftle  阅读(104)  评论(0)    收藏  举报