更目錄build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { //構(gòu)建腳本引用
repositories { //插件倉庫配置
google()
jcenter() //Jcenter() 本質(zhì)是一個(gè)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 { //全部項(xiàng)目配置
repositories { //全部項(xiàng)目引用的基礎(chǔ)倉庫配置
google()
jcenter()
}
}
task clean(type: Delete) { //聲明任務(wù)
delete rootProject.buildDir //刪除主路徑buildDiar文件夾
}
app 的build.gradle
apply plugin: 'com.android.application' //引入編譯構(gòu)建Gradle插件
android {
compileSdkVersion 28 //編譯的SDK
defaultConfig { //默認(rèn)配置
applicationId "com.igp.sex" //應(yīng)用程式ID
minSdkVersion 15 //最小支持版本
targetSdkVersion 28 //支持的目標(biāo)版本
versionCode 1 //版本號
versionName "1.0" //版本名
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" //測試腳本
}
buildTypes { //構(gòu)建類型
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'
}