123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- //配置各个module共用的参数
- apply plugin: 'kotlin-android'
- apply plugin: 'kotlin-android-extensions'
- apply plugin: 'kotlin-kapt'//kotlin语言使用注入框架,dataBinding都需要这个
- apply plugin: 'androidx.navigation.safeargs.kotlin'//用于navigation传参的时候一种安全防护,非空,类型判断等。
- android {
- compileSdkVersion compile_sdk_version
- buildToolsVersion build_tools_version
- defaultConfig {
- minSdkVersion min_sdk_verion
- targetSdkVersion target_sdk_version
- versionCode lib_version_code
- versionName lib_version_name
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- consumerProguardFiles 'consumer-rules.pro'
- //Java中的配置 生成schema文件,便于查看数据库创建表的详细信息
- javaCompileOptions {
- annotationProcessorOptions {
- //room 的scheme
- arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
- // ARouter的需要配置
- arguments = [AROUTER_MODULE_NAME: project.getName()]
- }
- }
- //kotlin ARouter 的配置方式
- kapt {
- arguments {
- arg("AROUTER_MODULE_NAME", project.getName())
- arg("room.schemaLocation": "$projectDir/schemas".toString())
- }
- }
- ndk {
- //选择要添加的对应 cpu 类型的 .so 库。
- abiFilters 'armeabi-v7a', 'arm64-v8a'
- // 还可以添加 'armeabi','x86', 'x86_64', 'mips', 'mips64'
- }
- // dex突破65535的限制
- multiDexEnabled true
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- //AndroidStudio 4 以下使用这种方式配置dataBinding
- // dataBinding {
- // isEnabled = true
- // }
- //AS4 以上版本使用这个配置dataBinding
- buildFeatures {
- dataBinding = true
- viewBinding = true
- }
- compileOptions {
- sourceCompatibility = 1.8
- targetCompatibility = 1.8
- }
- //使用jetPack的组件,会要求jdk 1.8最好,有的时候会遇到报错,需要配置如下,避免target jvm 1.8的那个报错
- kotlinOptions {
- jvmTarget = "1.8"
- // freeCompilerArgs += ["-Xuse-experimental=kotlin.contracts.ExperimentalContracts",]
- freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn",]
- }
- }
- dependencies {
- implementation fileTree(include: ['*.jar'], dir: 'libs')
- //region 平台相关的基础库
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1"
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1"
- implementation 'androidx.appcompat:appcompat:1.2.0'
- implementation 'androidx.core:core-ktx:1.3.2'
- implementation 'androidx.fragment:fragment-ktx:1.2.5'
- implementation 'androidx.activity:activity-ktx:1.1.0'
- implementation "androidx.constraintlayout:constraintlayout:2.0.4"
- implementation 'androidx.recyclerview:recyclerview:1.1.0'
- implementation 'com.google.android.material:material:1.2.1'
- implementation "androidx.viewpager2:viewpager2:1.0.0"
- implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
- // dataBinding和viewBinding消除模版代码的库
- implementation 'com.hi-dhl:binding:1.0.7'
- //endregion
- //region 优秀第三方必备框架库
- // 多级联动 选择
- implementation 'com.contrarywind:Android-PickerView:4.1.9'
- // 多级联动 选择
- implementation 'com.contrarywind:wheelview:4.1.0'
- // 状态栏 基础依赖包,必须要依赖
- implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
- // // 图片裁剪
- // implementation 'com.github.yalantis:ucrop:2.2.6'
- // 输入验证码view
- implementation 'com.xw.repo:fillblankview:2.3'
- // 2、下载框架
- implementation 'com.liulishuo.filedownloader:library:1.7.7'
- // QMUI
- implementation 'com.qmuiteam:qmui:2.0.0-alpha10'
- // 圆形 ImageView
- implementation "de.hdodenhof:circleimageview:2.2.0"
- // json 动画
- implementation "com.airbnb.android:lottie:3.4.0"
- // RecyclerViewAdapter
- implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4'
- // 刷新加载视图
- implementation 'com.scwang.smart:refresh-layout-kernel:2.0.1' //核心必须依赖
- implementation 'com.scwang.smart:refresh-header-classics:2.0.1' //经典刷新头
- implementation 'com.scwang.smart:refresh-header-material:2.0.3' //谷歌刷新头
- // OSS
- api "com.aliyun.dpa:oss-android-sdk:2.9.3"
- //ARouter
- implementation 'com.alibaba:arouter-api:1.5.0'
- kapt 'com.alibaba:arouter-compiler:1.5.1'
- //liveData eventBus
- implementation 'com.jeremyliao:live-event-bus-x:1.7.2'
- //endregion
- // region Koin for Kotlin
- implementation "org.koin:koin-core:$koin_version"
- implementation "org.koin:koin-core-ext:$koin_version"
- // Koin for AndroidX
- implementation "org.koin:koin-androidx-scope:$koin_version"
- implementation "org.koin:koin-androidx-viewmodel:$koin_version"
- implementation "org.koin:koin-androidx-fragment:$koin_version"
- implementation "org.koin:koin-androidx-ext:$koin_version"
- testImplementation "org.koin:koin-test:$koin_version"
- // endregion
- //region jetPack libs
- // implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'//已经废弃
- implementation 'androidx.lifecycle:lifecycle-livedata:2.2.0'
- implementation 'androidx.lifecycle:lifecycle-viewmodel:2.2.0'
- implementation 'androidx.lifecycle:lifecycle-runtime:2.2.0'
- implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
- implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
- kapt "androidx.lifecycle:lifecycle-common-java8:2.2.0"
- implementation 'androidx.room:room-runtime:2.2.5'
- implementation 'androidx.room:room-common:2.2.5'
- implementation 'androidx.room:room-ktx:2.2.5'
- kapt "androidx.room:room-compiler:2.2.5"
- implementation 'androidx.paging:paging-runtime:3.0.0-alpha10'
- implementation 'androidx.paging:paging-common:3.0.0-alpha10'
- implementation 'androidx.work:work-runtime:2.4.0'
- implementation 'androidx.work:work-runtime-ktx:2.4.0'
- //注意配置navigation版本号的时候,project下的build.gradle的class path也需要同步navigation的版本号配置
- implementation "androidx.navigation:navigation-ui:$navigation_version"
- implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"
- implementation "androidx.navigation:navigation-fragment:$navigation_version"
- implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
- implementation "androidx.navigation:navigation-runtime:$navigation_version"
- // CameraX 核心库使用 camera2 实现
- implementation "androidx.camera:camera-camera2:1.0.0-beta07"
- // 可以使用CameraView
- implementation "androidx.camera:camera-view:1.0.0-alpha14"
- // 可以使用供应商扩展
- implementation "androidx.camera:camera-extensions:1.0.0-alpha14"
- //camerax的生命周期库
- implementation "androidx.camera:camera-lifecycle:1.0.0-beta07"
- //endregion
- //region test libs
- testImplementation 'junit:junit:4.13'
- androidTestImplementation 'androidx.test.ext:junit:1.1.2'
- androidTestImplementation 'androidx.test:core:1.3.0'
- androidTestImplementation 'androidx.test:core-ktx:1.2.0'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
- //endregion
- }
|