一、将自定义 Gradle 插件上传到远程仓库中
Android Gradle 插件 也是一种 自定义的 Gradle 插件 , 该插件被上传到 jcenter / google / mavenCentral 远程仓库 中进行存储 , 在 Android Studio 工程的根目录中的 build.gradle 构建脚本中 , 通过如下方式将 自定义插件 引入 Android 工程 ;
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
然后 , 在 Module 模块中通过
apply plugin:'com.android.application'
plugins {
id 'com.android.application'
}