-
Notifications
You must be signed in to change notification settings - Fork 0
/
appFlavor.gradle
88 lines (79 loc) · 3.02 KB
/
appFlavor.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/**2023-6-20 */
def _M_SDK = project.hasProperty("M_SDK") ? project.ext.M_SDK : '21'
def _minify_enabled_debug = project.hasProperty("minify_enabled_debug") ? (project.ext.minify_enabled_debug == "true") : false
def _minify_enabled = project.hasProperty("minify_enabled") ? (project.ext.minify_enabled == "true") : _minify_enabled_debug
android {
if (gradle.gradleVersion.charAt(0) >= '8') {
flavorDimensions = ['flavor']
} else {
flavorDimensions 'flavor'
}
productFlavors {
//develop
_dev {
dimension "flavor"
minSdkVersion Math.max(Integer.parseInt(_M_SDK), 21)
resValue "bool", "is_preview", "true"
}
//preview
pre {
//https://developer.android.com/studio/build/build-variants
//applicationIdSuffix ".pre"
//versionNameSuffix "-pre"
//applicationId "com.acc.xxx.pre"
//versionCode 100
//versionName "1.0.0"
dimension "flavor"
minSdkVersion Integer.parseInt(_M_SDK)
resValue "bool", "is_preview", "true"
}
//apk
apk {
dimension "flavor"
minSdkVersion Integer.parseInt(_M_SDK)
resValue "bool", "is_preview", "false"
//applicationId "com.angcyo.xxx.xxx"
//versionName project.hasProperty("V_NAME_RELEASE") ? project.ext.V_NAME_RELEASE : project.ext.V_NAME
}
}
buildTypes {
debug {
//applicationIdSuffix ".debug"
zipAlignEnabled true
shrinkResources false
minifyEnabled _minify_enabled_debug
//useProguard _use_proguard_debug //默认会使用R8压缩优化代码
signingConfig signingConfigs.angcyo
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
debuggable true
jniDebuggable = true
crunchPngs = false
ext.enableCrashlytics = false
ext.alwaysUpdateBuildId = false
resValue "bool", "show_debug", "true"
resValue "bool", "is_debug", "true"
}
pretest {
//https://developer.android.com/studio/build/build-variants
//applicationIdSuffix ".pretest"
//manifestPlaceholders = [hostName:"internal.example.com"]
initWith debug
minifyEnabled _minify_enabled
resValue "bool", "show_debug", "true"
resValue "bool", "is_debug", "true"
//匹配回退
//https://developer.android.com/studio/build/build-variants?hl=zh-cn#resolve_matching_errors
matchingFallbacks = ['debug']
}
release {
//applicationIdSuffix ".release"
initWith debug
minifyEnabled _minify_enabled
debuggable false
jniDebuggable = false
crunchPngs = true
resValue "bool", "show_debug", "false"
resValue "bool", "is_debug", "false"
}
}
}