引言
我們知道Android studio 需要gradle插件進(jìn)行構(gòu)建和編譯,隨著AGP的升級,引入gradle插件也發(fā)生了變化。舊版本通過build.gradle文件中dependencies代碼塊引入,新版本通過plugins代碼塊引入
一、舊版本引入方式dependencies
二、新版本引入方式plugins
plugins {
id 'com.android.application' version '8.1.0' apply false
id 'com.android.library' version '8.1.0' apply false
}
三、兩種方式的插件對應(yīng)倉庫中心(以阿里云鏡像倉庫示例)
(1)dependencies
<dependency>
<groupId>com.android.tools.build</groupId>
<artifactId>gradle</artifactId>
<version>8.1.0-beta01</version>
<type>pom</type>
</dependency>
(2)plugins
<dependency>
<groupId>com.android.application</groupId>
<artifactId>com.android.application.gradle.plugin</artifactId>
<version>8.1.0-alpha09</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.android.library</groupId>
<artifactId>com.android.library.gradle.plugin</artifactId>
<version>8.1.0-beta01</version>
<type>pom</type>
</dependency>
參考:
【1】Gradle學(xué)習(xí)筆記之插件_gradle 添加插件-CSDN博客
【2】倉庫服務(wù)文章來源:http://www.zghlxwxcb.cn/news/detail-784136.html
【3】關(guān)于Gradle新版插件依賴方式_gradlepluginportal-CSDN博客文章來源地址http://www.zghlxwxcb.cn/news/detail-784136.html
到了這里,關(guān)于Android——gradle插件配置方式——dependencies和plugins的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!