-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.gradle
72 lines (62 loc) · 2.51 KB
/
app.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
//apply from: "config.gradle" 同级目录
apply from: "${rootProject.rootDir}/dependencies.gradle"
project.ext {
// 设置 app 配置
setAppDefaultConfig = {
extension ->
// 指定为 application
extension.apply plugin: "com.android.application"
extension.description "app"
// 公共的 apply 主要是用于三方库
extension.apply plugin: 'kotlin-android'
extension.apply plugin: 'kotlin-parcelize'
extension.apply plugin: 'kotlin-kapt'
extension.apply plugin: 'com.blankj.bus'
extension.apply plugin: 'androidx.navigation.safeargs.kotlin' // navigation 导航
extension.apply plugin: 'com.alibaba.arouter' // Gradle 插件实现路由表的自动加载
appImplementation = "app"
//设置项目的android
setAppAndroidConfig extension.android
//设置项目的三方库依赖
setDependencies extension.dependencies
}
//设置application 公共的android配置
setAppAndroidConfig = {
extension ->
extension.compileSdkVersion project.ext.compileSdkVersion
extension.defaultConfig {
applicationId project.ext.applicationId
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
versionCode project.ext.versionCode
versionName project.ext.versionName
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
extension.flavorDimensions "default"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
abiFilters 'arm64-v8a', "x86_64"
// abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', "x86_64"
}
}
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
//Java版本配置
extension.compileOptions {
encoding "utf-8"
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
// extension.kotlinOptions {
// jvmTarget = '11'
// useIR = true
// }
// 启用 viewBinding
extension.buildFeatures {
viewBinding = true
}
}
}