Android——gradle插件配置方式——dependencies和plugins

引言

我们知道Android studio 需要gradle插件进行构建和编译,随着AGP的升级,引入gradle插件也发生了变化。旧版本通过build.gradle文件中dependencies代码块引入,新版本通过plugins代码块引入

一、旧版本引入方式dependencies

Android——gradle插件配置方式——dependencies和plugins

二、新版本引入方式plugins

plugins {
    id 'com.android.application' version '8.1.0' apply false
    id 'com.android.library' version '8.1.0' apply false
}

三、两种方式的插件对应仓库中心(以阿里云镜像仓库示例)

(1)dependencies

    com.android.tools.build
    gradle
    8.1.0-beta01
    pom

Android——gradle插件配置方式——dependencies和plugins

(2)plugins

    com.android.application
    com.android.application.gradle.plugin
    8.1.0-alpha09
    pom




    com.android.library
    com.android.library.gradle.plugin
    8.1.0-beta01
    pom

Android——gradle插件配置方式——dependencies和plugins

Android——gradle插件配置方式——dependencies和plugins

参考:

【1】Gradle学习笔记之插件_gradle 添加插件-CSDN博客

【2】仓库服务

【3】关于Gradle新版插件依赖方式_gradlepluginportal-CSDN博客

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/13f1897407.html