更目录build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { //构建脚本引用
repositories { //插件仓库配置
google()
jcenter() //Jcenter() 本质是一个Maven仓库
}
dependencies { //依赖插件
classpath 'com.android.tools.build:gradle:3.1.4' //Google Android Gradle 插件
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects { //全部项目配置
repositories { //全部项目引用的基础仓库配置
google()
jcenter()
}
}
task clean(type: Delete) { //声明任务
delete rootProject.buildDir //删除主路径buildDiar文件夹
}
app 的build.gradle
apply plugin: 'com.android.application' //引入编译构建Gradle插件
android {
compileSdkVersion 28 //编译的SDK
defaultConfig { //默认配置
applicationId "com.igp.sex" //应用程式ID
minSdkVersion 15 //最小支持版本
targetSdkVersion 28 //支持的目标版本
versionCode 1 //版本号
versionName "1.0" //版本名
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" //测试脚本
}
buildTypes { //构建类型
release { //release 版本配置
minifyEnabled false //不使用混淆
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' //混淆文件
}
}
}
dependencies { //依赖插件
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
网友评论