Files
fuzhu/wechat/build.gradle
wming-black 3764c45d81 WeChat
2021-12-07 15:09:26 +08:00

102 lines
4.0 KiB
Groovy
Raw 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'
if (isRelease) { // 如果是发布版本时,各个模块都不能独立运行
apply plugin: 'com.android.library' // 正式环境 library不能独立运行
} else {
apply plugin: 'com.android.application' // 测试环境 application独立运行
}
// 完整的方式 性能
android {
compileSdkVersion app_android.compileSdkVersion
buildToolsVersion app_android.buildToolsVersion
defaultConfig {
// applicationId app_appid.personal
if (!isRelease) { // 如果是集成化模式不能有applicationId
applicationId app_appid.personal // 组件化模式能独立运行才能有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 {
arguments = [moduleName: project.getName(), packageNameForAPT: packageNameForAPT]
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
if (!isRelease) {
// 如果是组件化模式,需要单独运行时 Debug
manifest.srcFile 'src/main/debug/AndroidManifest.xml' // 生效
} else { // 正式环境下
// 集成化模式整个项目打包apk
manifest.srcFile 'src/main/AndroidManifest.xml' // 让我们之前 默认的路径下的清单文件再次生效
java {
// release 时 debug 目录下文件不需要合并到主工程
exclude "**/debug/**"
}
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.material:material:1.3.0'
/*implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'*/
// 循环引入第三方库
app_dependencies.each {k, v ->implementation v}
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// 公共基础库
implementation project(":common")
// 注解模块
implementation project(":arouter_annotation")
// 使用注解处理器
// 注解处理器
annotationProcessor project(':arouter_compiler')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.getbase:floatingactionbutton:1.9.0'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
api 'com.blankj:utilcode:1.23.7'
}