我们知道Android studio 需要gradle插件进行构建和编译,随着AGP的升级,引入gradle插件也发生了变化。旧版本通过build.gradle文件中dependencies代码块引入,新版本通过plugins代码块引入
- plugins {
- id 'com.android.application' version '8.1.0' apply false
- id 'com.android.library' version '8.1.0' apply false
- }
- <dependency>
- <groupId>com.android.tools.buildgroupId>
- <artifactId>gradleartifactId>
- <version>8.1.0-beta01version>
- <type>pomtype>
- dependency>
- <dependency>
- <groupId>com.android.applicationgroupId>
- <artifactId>com.android.application.gradle.pluginartifactId>
- <version>8.1.0-alpha09version>
- <type>pomtype>
- dependency>
-
-
- <dependency>
- <groupId>com.android.librarygroupId>
- <artifactId>com.android.library.gradle.pluginartifactId>
- <version>8.1.0-beta01version>
- <type>pomtype>
- dependency>
参考:
【1】Gradle学习笔记之插件_gradle 添加插件-CSDN博客
【2】仓库服务