/*应用插件,两种值可选com.android.application(应用程序模块,可直接运行)或者com.android.library(库模块,作为代码库依附于别的应用程序模块运行)*/
apply plugin: 'com.android.application'
/*配置项目构建的各种属性*/
android {
compileSdkVersion 26/*指定项目编译版本*/
/*项目细节配置*/
defaultConfig {
applicationId "com.example.administrator.activitytest"
minSdkVersion 22/*最低兼容系统版本*/
targetSdkVersion 26/*引入高版本新功能*/
versionCode 1/*版本号*/
versionName "1.0"/*版本名*/
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
//生成安装文件的相关配置
buildTypes {
release {
minifyEnabled false//是否对项目代码混淆,true混淆
/*混淆时使用的规则文件,proguard-android.txt在sdk中是所有项目通用混淆规则,proguard-rules.pro在当前项目下,可以编写当前项目混淆规则*/
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//本地依赖
implementation fileTree(dir: 'libs', include: ['*.jar'])
//远程依赖
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
app目录下的build.gradle解析
最新推荐文章于 2023-11-13 16:25:11 发布