build.gradle
4.1 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
apply plugin: 'com.android.application'
//apply plugin: 'com.antfortune.freeline'
apply plugin: 'com.ceabie.dexnkife'
//apply tinker插件
apply plugin: 'com.tencent.tinker.patch'
apply plugin: 'walle'
println '是否编译全部组件' + rootProject.ext.buildAllModule
android {
useLibrary 'org.apache.http.legacy'
// freeline {
// hack true
// applicationProxy false
// productFlavor 'dev'
// }
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"]
resourcePrefix "main_"
defaultConfig {
applicationId "com.xdy.edulive"
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
versionCode rootProject.ext.android["versionCode"]
versionName rootProject.ext.android["versionName"]
//ADD THIS LINE:
testInstrumentationRunner rootProject.ext.dependencies["androidJUnitRunner"]
multiDexEnabled true
multiDexKeepProguard file("proguard-rules.pro")
}
signingConfigs {
release {
storeFile file("C:\\DevelopTool\\work_info\\xdy.jks")
storePassword 'xdy2017'
keyPassword 'xdy2017'
keyAlias 'xdy'
}
debug {
storeFile file("C:\\DevelopTool\\work_info\\xdy.jks")
storePassword 'xdy2017'
keyPassword 'xdy2017'
keyAlias 'xdy'
}
}
buildTypes {
release {
//是否混淆
minifyEnabled true
//是否对apk进行签名
multiDexEnabled true
signingConfig signingConfigs.release
zipAlignEnabled true
shrinkResources true//去除无用的resource文件,第一次使用
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
multiDexEnabled true
minifyEnabled false
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
//Tinker recommend or build failed
dexOptions {
jumboMode = true
javaMaxHeapSize "4g"
}
compileOptions {
sourceCompatibility rootProject.ext.android["javaVersion"]
targetCompatibility rootProject.ext.android["javaVersion"]
}
lintOptions {
abortOnError false
}
productFlavors {
official {}
productFlavors.all { flavor ->
}
}
//ADD THESE LINES:
packagingOptions {
exclude 'LICENSE.txt'
}
//配合AndroidTestCase
configurations.all {
resolutionStrategy.force rootProject.ext.dependencies['annotations']
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//Unit JUnit && ApplicationTest CASE
// testCompile rootProject.ext.dependencies["junit"]
// androidTestCompile rootProject.ext.dependencies["espresso-core"]
// androidTestCompile rootProject.ext.dependencies["runner"]
// androidTestCompile 'com.android.support.test:rules:0.2'
//分包、打包及热修复
compile 'com.android.support:multidex:1.0.1'
compile 'com.meituan.android.walle:library:1.1.0'
provided("com.tinkerpatch.sdk:tinkerpatch-android-sdk:1.1.3")
if (rootProject.ext.buildAllModule) {
compile project(':home')
compile project(':OrderModule')
} else {
compile project(':CommonLib')
}
// releaseCompile project(path: ':commonlibrary', configuration: 'release')
// debugCompile project(path: ':commonlibrary', configuration: 'debug')
}
walle {
// 指定渠道包的输出路径
apkOutputFolder = new File("${project.buildDir}/outputs/channels");
// 定制渠道包的APK的文件名称
apkFileNameFormat = '${appName}-${buildType}-${channel}-v${versionName}.apk';
// 配置渠道文件列表,也可以通过channelList来配置
channelFile = new File("${project.getProjectDir()}/channels")
}
apply from: 'tinkerpatch.gradle'