132 lines
4.3 KiB
Groovy
132 lines
4.3 KiB
Groovy
apply plugin: 'com.android.application'
|
||
|
||
// 定义变量,同学们注意:可以定义变量,也可以不定义变量
|
||
def app_android = this.getRootProject().ext.app_android;
|
||
def app_dependencies = this.rootProject.ext.app_dependencies;
|
||
|
||
android {
|
||
// compileOptions.encoding = "GBK"
|
||
compileSdkVersion app_android.compileSdkVersion
|
||
buildToolsVersion app_android.buildToolsVersion
|
||
defaultConfig {
|
||
applicationId app_android.applicationId
|
||
minSdkVersion app_android.minSdkVersion
|
||
targetSdkVersion app_android.targetSdkVersion
|
||
versionCode app_android.versionCode
|
||
versionName app_android.versionName
|
||
testInstrumentationRunner app_android.testInstrumentationRunner
|
||
|
||
// 这个方法接收三个非空的参数,第一个:确定值的类型,第二个:指定key的名字,第三个:传值(必须是String)
|
||
// 为什么需要定义这个?因为src代码中有可能需要用到跨模块交互,如果是组件化模块显然不行
|
||
// 切记:不能在android根节点,只能在defaultConfig或buildTypes节点下
|
||
buildConfigField("boolean", "isRelease", String.valueOf(isRelease))
|
||
|
||
// 在gradle文件中配置选项参数值(用于APT传参接收)
|
||
// 同学们注意:切记:必须写在defaultConfig节点下
|
||
javaCompileOptions {
|
||
annotationProcessorOptions {
|
||
// project.getName() == app
|
||
arguments = [moduleName: project.getName(), packageNameForAPT: packageNameForAPT]
|
||
}
|
||
}
|
||
}
|
||
buildTypes {
|
||
|
||
debug {
|
||
buildConfigField("String", "debug", "\"${url.debug}\"")
|
||
|
||
minifyEnabled false
|
||
debuggable true
|
||
}
|
||
release {
|
||
buildConfigField("String", "release", "\"${url.release}\"")
|
||
|
||
minifyEnabled false
|
||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||
aaptOptions.cruncherEnabled = false
|
||
aaptOptions.useNewCruncher = false
|
||
applicationVariants.all { variant ->
|
||
variant.outputs.all {
|
||
// 输出apk名称为dc_v1.0_wandoujia.apk
|
||
def fileName = "atom-latest.apk"
|
||
outputFileName = fileName
|
||
}
|
||
}
|
||
}
|
||
}
|
||
lintOptions {
|
||
checkReleaseBuilds false
|
||
abortOnError false
|
||
}
|
||
//签名
|
||
signingConfigs {
|
||
release {
|
||
|
||
storeFile file('fuzhu.jks')
|
||
storePassword "123456"
|
||
keyAlias "fuzhu"
|
||
keyPassword "123456"
|
||
}
|
||
|
||
}
|
||
dataBinding {
|
||
enabled = true
|
||
}
|
||
compileOptions {
|
||
sourceCompatibility = '1.8'
|
||
targetCompatibility = '1.8'
|
||
}
|
||
}
|
||
|
||
this.android.sourceSets {
|
||
main {
|
||
jniLibs.srcDirs = ['libs']
|
||
res.srcDirs = ['src/main/res', 'src/main/res_zxing']
|
||
}
|
||
}
|
||
dependencies {
|
||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||
|
||
// 循环引入第三方库
|
||
app_dependencies.each {k, v ->
|
||
// if (k != "aa" && v != "cc") {}
|
||
implementation v
|
||
}
|
||
|
||
|
||
testImplementation 'junit:junit:4.12'
|
||
androidTestImplementation 'androidx.test:runner:1.2.0'
|
||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||
|
||
implementation files('libs\\eventbus-2.4.0.jar')
|
||
implementation files('lib\\XposedBridgeApi-54.jar')
|
||
androidTestImplementation 'androidx.test:runner:1.2.0'
|
||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||
api 'com.blankj:utilcode:1.23.7'
|
||
api 'com.tencent.bugly:crashreport:latest.release'
|
||
// 公共基础库
|
||
implementation project(":common")
|
||
|
||
// arouter 专用 注解模块
|
||
implementation project(":arouter_annotation")
|
||
|
||
// 使用注解处理器
|
||
// arouter 专用 注解处理器
|
||
annotationProcessor project(':arouter_compiler')
|
||
|
||
// 如果是集成化模式,做发布版本时。各个模块都不能独立运行了
|
||
if (isRelease) {
|
||
// 进if,集成,融为一体(order,personal)
|
||
|
||
// 订单模块
|
||
implementation project(":order")
|
||
|
||
// 个人中心模块
|
||
implementation project(":personal")
|
||
|
||
// 个人中心模块
|
||
implementation project(":wechat")
|
||
|
||
}
|
||
}
|