apply plugin: 'com.android.application' android { compileSdkVersion 28 buildToolsVersion '28.0.3' aaptOptions.cruncherEnabled = false aaptOptions.useNewCruncher = false defaultConfig { versionCode 11 versionName "1.8.7" minSdkVersion 17 tar
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
defaultConfig {
versionCode 11
versionName "1.8.7"
minSdkVersion 17
targetSdkVersion 24
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
signingConfigs {
release {
keyAlias 'XXX_key'
keyPassword 'XXXXXXXXXX'
storeFile file('../XXX相关/密钥/XXX_key.jks')
storePassword 'XXXXXXXXXX'
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
buildConfigField 'boolean', 'isConsoleLog', 'false'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField 'boolean', 'isConsoleLog', 'true'
debuggable true
}
//3.0+版本
android.applicationVariants.all {
variant ->
//这个修改输出的APK路径
variant.getPackageApplication().outputDirectory = new File(project.rootDir.absolutePath + "/apk")
variant.outputs.all {
//在这里修改apk文件名,引号内的字符串都可以随便定义(firmServiceDebug_1.8.7_11_(20201009083747))
def curDate = new Date().format("yyyyMMddHHmmss", TimeZone.getTimeZone("GMT+08:00"))
def apkName
if (variant.buildType.name.equals('release')) {
if ("${variant.name}" == "firmServiceRelease") {
apkName = "XXX2539293"
} else if ("${variant.name}" == "releaseServiceRelease") {
apkName = "XXX378090"
} else {
apkName = "XXX未知"
}
outputFileName = "${apkName}_${variant.versionName}_${variant.versionCode}(${curDate}).apk"
} else {
outputFileName = "${variant.name}_${variant.versionName}_${variant.versionCode}_(${curDate}).apk"
}
}
}
}
productFlavors {
releaseService {
//正式服务器
signingConfig signingConfigs.release
buildConfigField 'String', 'ROOT_URL', '"http://XXXXXXXXXX:8090"'
}
firmService {
//公司服务器
signingConfig signingConfigs.debug
buildConfigField 'String', 'ROOT_URL', '"http://XXXXXXXXXX:8090"'
}
//自定义打包类型时 好像必须指定签名
otherService {
//其他服务器
signingConfig signingConfigs.debug
buildConfigField 'String', 'ROOT_URL', '"http://www.other.com"'
//(当依赖了其他module时)自定义打包类型需要加上下面这行代码
// matchingFallbacks = ['debug']
}
}
// 移除lint检查的error
lintOptions {
abortOnError false
/*抑制清单文件警告*/
disable 'GoogleAppIndexingWarning'
}
configurations {
all {
exclude module: 'commons-logging'
}
}
flavorDimensions "1"
}
dependencies {
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:support-vector-drawable:28.0.0'
}