Files
fuzhu/app/build.gradle
2026-01-05 15:39:47 +08:00

159 lines
5.5 KiB
Groovy
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
apply plugin: 'com.android.application'
// 定义变量,同学们注意:可以定义变量,也可以不定义变量
def app_android = this.getRootProject().ext.app_android;
def app_dependencies = this.rootProject.ext.app_dependencies;
android {
namespace 'com.fisherbone.fuzhu'
// compileOptions.encoding = "GBK"
compileSdk app_android.compileSdkVersion
compileSdkVersion app_android.compileSdkVersion
buildToolsVersion app_android.buildToolsVersion
defaultConfig {
applicationId app_android.applicationId
minSdk app_android.minSdkVersion
minSdkVersion app_android.minSdkVersion
targetSdk app_android.targetSdkVersion
targetSdkVersion app_android.targetSdkVersion
versionCode app_android.versionCode
versionName app_android.versionName
testInstrumentationRunner app_android.testInstrumentationRunner
multiDexEnabled true //突破应用方法数65535的一个限制
// 这个方法接收三个非空的参数第一个确定值的类型第二个指定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'
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"
}
}
buildFeatures {
buildConfig true
dataBinding true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
jniLibs {
useLegacyPackaging = true
}
}
}
this.android.sourceSets {
main {
jniLibs.srcDirs = ['libs']
res.srcDirs = ['src/main/res', 'src/main/res_zxing']
}
}
configurations.all {
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk7'
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
}
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.30.6'
api 'com.tencent.bugly:crashreport:latest.release'
// 公共基础库
implementation project(":common")
// arouter 专用 注解模块
implementation project(":arouter_annotation")
// 使用注解处理器
// arouter 专用 注解处理器
annotationProcessor project(':arouter_compiler')
// 将 Kotlin 标准库添加到注解处理器的 classpathDataBinding 编译器需要)
annotationProcessor 'org.jetbrains.kotlin:kotlin-stdlib:1.9.22'
// 如果是集成化模式,做发布版本时。各个模块都不能独立运行了
if (isRelease) {
// 进if集成融为一体orderpersonal
// 订单模块
implementation project(":order")
// 个人中心模块
implementation project(":personal")
// 个人中心模块
implementation project(":wechat")
}
implementation 'com.github.gzu-liyujiang:Android_CN_OAID:4.0.0'
// Kotlin 标准库DataBinding 在 AGP 8.x 中需要,版本需要与 AGP 兼容)
// 使用 compileOnly 确保在编译时可用,但不会打包到 APK 中(如果项目不使用 Kotlin
compileOnly 'org.jetbrains.kotlin:kotlin-stdlib:1.9.22'
// 同时添加到 implementation 以确保运行时可用(如果 DataBinding 生成的代码需要)
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.9.22'
}