95 lines
3.7 KiB
Groovy
95 lines
3.7 KiB
Groovy
|
|
// 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/**"
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
dependencies {
|
|||
|
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|||
|
|
|
|||
|
|
/*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.github.Levine1992:Abllib:V1.0'
|
|||
|
|
implementation 'com.getbase:floatingactionbutton:1.9.0'
|
|||
|
|
}
|