-
Notifications
You must be signed in to change notification settings - Fork 230
/
Copy pathbuild.gradle
114 lines (103 loc) · 3.75 KB
/
build.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
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
//参考:https://raw.github.com/dm77/barcodescanner/master/build.gradle
buildscript {
repositories {
jcenter()
google()
}
dependencies {
//2.3.3 jitpack 发布用的版本
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
}
}
allprojects {
// group = GROUP
// version = VERSION_NAME
repositories {
jcenter() //bintray的maven库
mavenCentral() //sonatype的maven库
// mavenLocal() //本地的maven库
maven {
url "https://www.jitpack.io" //jitpack的maven库
}
flatDir {
dirs 'libs' //本地aar文件
}
google()
}
ext {
isLibrary = false
pomArtifactId = project.name
pomVersion = VERSION_NAME
pomDescription = 'This is library description'
}
}
subprojects {
afterEvaluate { Project project ->
ext.pluginContainer = project.getPlugins()
def hasAppPlugin = ext.pluginContainer.hasPlugin("com.android.application")
def hasLibPlugin = ext.pluginContainer.hasPlugin("com.android.library")
if (hasAppPlugin || hasLibPlugin) {
android {
compileSdkVersion COMPILE_SDK_VERSION as int
buildToolsVersion BUILD_TOOL_VERSION
// aaptOptions {
// cruncherEnabled = false
// useNewCruncher = false
// }
defaultConfig {
minSdkVersion MIN_SDK_VERSION as int
targetSdkVersion TARGET_SDK_VERSION as int
versionCode VERSION_CODE as int
versionName VERSION_NAME
}
buildTypes {
release {
debuggable false
minifyEnabled false //实时构建库项目时若启用混淆,APP模块引用会造成部分方法找不到
}
debug {
debuggable true
minifyEnabled false
}
}
// aaptOptions{
// cruncherEnabled false
// useNewCruncher false
// }
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/ASL2.0'
}
}
dependencies {
//自己项目加入版本覆盖依赖包的版本
implementation "com.android.support:support-v4:${ANDROID_SUPPORT_VERSION}"
implementation "com.android.support:support-annotations:${ANDROID_SUPPORT_VERSION}"
implementation "com.android.support:appcompat-v7:${ANDROID_SUPPORT_VERSION}"
implementation "com.android.support.constraint:constraint-layout:${CONSTRAINTLAYOUT}"
implementation "com.blankj:utilcode:1.26.0"
}
}
// if (project.isLibrary) {
// configure(project) {
// apply from: "${rootDir}/publish.gradle" //调用发布脚本
// }
// }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}