forked from qq549631030/AndroidJunkCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
104 lines (97 loc) · 3.04 KB
/
build.gradle
File metadata and controls
104 lines (97 loc) · 3.04 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
if (PLUGIN_ENABLE.toBoolean()) {
apply plugin: 'android-junk-code'
}
apply plugin: 'com.getkeepsafe.dexcount'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 31
defaultConfig {
applicationId "cn.hx.plugin.junkcode.demo"
minSdkVersion 16
targetSdkVersion 31
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
dataBinding = true
viewBinding = true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
flavorDimensions 'PRODUCT'
productFlavors {
free {
dimension 'PRODUCT'
}
pro {
dimension 'PRODUCT'
}
}
applicationVariants.all { variant ->
def mergedFlavor = variant.mergedFlavor
switch (variant.flavorName) {
case "free":
switch (variant.buildType.name) {
case "debug":
mergedFlavor.manifestPlaceholders += ["API_KEY": "appKey1"]
break
case "release":
mergedFlavor.manifestPlaceholders += ["API_KEY": "appKey2"]
break
}
break
case "pro":
switch (variant.buildType.name) {
case "debug":
mergedFlavor.manifestPlaceholders += ["API_KEY": "appKey3"]
break
case "release":
mergedFlavor.manifestPlaceholders += ["API_KEY": "appKey4"]
break
}
break
}
}
}
if (PLUGIN_ENABLE.toBoolean()) {
androidJunkCode {
def config = {
packageBase = "cn.hx.plugin.ui"
packageCount = 30
activityCountPerPackage = 30
excludeActivityJavaFile = false
otherCountPerPackage = 50
methodCountPerClass = 20
resPrefix = "junk_"
drawableCount = 300
stringCount = 300
}
variantConfig {
freeRelease config
proRelease config
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}