forked from getActivity/AndroidProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
138 lines (122 loc) · 5.06 KB
/
build.gradle
File metadata and controls
138 lines (122 loc) · 5.06 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
136
137
138
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.hjq.demo"
minSdkVersion 14
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 10
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
//APK 签名的那些事:https://www.jianshu.com/p/a1f8e5896aa2
// signingConfigs {
// release {
// keyAlias '密钥别称'
// keyPassword '密钥密码'
// storeFile file('E:/MySign.jks')
// storePassword '密钥库密码'
// }
//
// debug {
// keyAlias '密钥别称'
// keyPassword '密钥密码'
// storeFile file('E:/MySign.jks')
// storePassword '密钥库密码'
// }
// }
buildTypes {
release {
// 不显示Log
buildConfigField "boolean", "LOG_DEBUG", "false"
// 移除无用的resource文件,前提minifyEnabled必须打开
shrinkResources true
// ZipAlign优化
zipAlignEnabled true
// 设置混淆
minifyEnabled true
//加载默认混淆配置涵
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// 正式环境签名
//signingConfig signingConfigs.release
}
debug {
//ZipAlign优化
zipAlignEnabled false
//设置混淆
minifyEnabled false
//加载默认混淆配置涵
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// 开发环境签名
//signingConfig signingConfigs.debug
}
}
flavorDimensions "default"//这个名字貌似随便取,也可以有多个,总之一定要有
//多渠道打包
productFlavors {
kuan {} //酷安
tencent {} //应用宝
baidu {} //百度
xiaomi {} //小米
huawei {} //华为
google {} //谷歌
productFlavors.all { flavor ->
flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
}
}
// JNI 目录
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
}
// api 与 implementation的区别:https://www.jianshu.com/p/8962d6ba936e
dependencies {
// 依赖 libs 目录下所有 Jar 包
implementation fileTree(include: ['*.jar'], dir: 'libs')
// 基础库(不包任何第三方框架)
implementation project(':base')
// 自定义 View
implementation project(':widget')
// 友盟
implementation project(':umeng')
// Dialog
implementation project(':dialog')
// 示例:添加一个 aar 包
// implementation(name: 'password_dialog', ext: 'aar')
implementation "com.android.support:appcompat-v7:$rootProject.ext.supportLibraryVersion"
implementation "com.android.support:design:$rootProject.ext.supportLibraryVersion"
implementation "com.android.support:support-v4:$rootProject.ext.supportLibraryVersion"
implementation "com.android.support:cardview-v7:$rootProject.ext.supportLibraryVersion"
implementation "com.android.support.constraint:constraint-layout:$rootProject.ext.constraintlayoutVersion"
// Dex分包,解决 65k 问题
implementation 'com.android.support:multidex:1.0.3'
// ButterKnife注解库:https://github.com/JakeWharton/butterknife
implementation 'com.jakewharton:butterknife:9.0.0-rc1'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1'
// 状态栏沉浸:https://github.com/gyf-dev/ImmersionBar
implementation 'com.gyf.immersionbar:immersionbar:2.3.3-beta09'
// 侧滑功能:https://github.com/bingoogolapple/BGASwipeBackLayout-Android
implementation 'cn.bingoogolapple:bga-swipebacklayout:1.2.0'
// 权限请求框架:https://github.com/getActivity/XXPermissions
implementation 'com.hjq:xxpermissions:5.2'
// 标题栏:https://github.com/getActivity/TitleBar
implementation 'com.hjq:titlebar:5.0'
// 吐司工具类:https://github.com/getActivity/ToastUtils
implementation 'com.hjq:toast:5.2'
// 圆形的ImageView:https://github.com/hdodenhof/CircleImageView
implementation 'de.hdodenhof:circleimageview:2.2.0'
// RecyclerView:https://github.com/CymChad/BaseRecyclerViewAdapterHelper
// 工具类集合:https://github.com/Blankj/AndroidUtilCode
// 图片选择:https://github.com/zhihu/Matisse
// 上拉下拉:https://github.com/bingoogolapple/BGARefreshLayout-Android
// 轮播图:https://github.com/bingoogolapple/BGABanner-Android
// 二维码:https://github.com/bingoogolapple/BGAQRCode-Android
}
repositories {
flatDir {
dirs 'libs' //就是你放aar的目录地址
}
}