}
都表示是一个依赖库,不能独立运行可生成jar或者aar
//apply plugin: ‘com.android.library’
//plugins {
// id ‘com.android.library’
//}
android {
compileSdkVersion 30//项目的编译版本
defaultConfig {
applicationId “com.scc.demo”//包名
minSdkVersion 23//最低的兼容的Android系统版本
targetSdkVersion 30//目标版本,表示你在该Android系统版本已经做过充分的测试
versionCode 1//版本号
versionName “1.0.0”//版本名称
ndk {
abiFilters ‘armeabi-v7a’, ‘arm64-v8a’
//运行环境,要上传Google Play必须兼容64位,这里仅兼容ARM架构
//对于ARM架构,32 位库位于armeabi-v7a 中。64 位等效项是arm64-v8a。
//对于x86体系结构,查找x86(用于 32 位)和 x86_64(用于 64 位)。
}
}
buildTypes {//配置了多个版本(设置自动打包环境)
release {
minifyEnabled false
proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’
}
//正常情况上面这个够用了,下面的用来了解
//指定生成安装文件的配置,常有两个子包:release,debug,
// 咱这边多一个子包,多一种配置方式
// 注:直接运行的都是debug安装文件
getByName(“release”) {
minifyEnabled true//是否开启收缩、混淆、优化,true开启
shrinkResources = true // 是否开启资源收缩 ,true开启
//applicationIdSuffix 未设置默认包名 applicationId “com.scc.demo”
proguardFiles(getDefaultProguardFile(“proguard-android.txt”), “proguard-rules.pro”)
}
getByName(“debug”) {
applicationIdSuffix = “.debug”//打包后会变成com.scc.demo.debug
minifyEnabled false
}
/**
- initWith 属性允许您从其他生成类型复制配置,
*/<