//配置各个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' } } 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" implementation "com.android.support:multidex:1.0.3" // 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' // 图片裁剪 implementation 'com.xw.repo:fillblankview:2.3' // 输入验证码view implementation 'com.liulishuo.filedownloader:library:1.7.7' // 下载框架 implementation 'com.qmuiteam:qmui:2.0.0-alpha10' // QMUI implementation "de.hdodenhof:circleimageview:2.2.0" // 圆形 ImageView implementation "com.airbnb.android:lottie:3.4.0" // json 动画 implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4' // RecyclerViewAdapter 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' // 刷新加载视图 谷歌刷新头 implementation 'com.alibaba:arouter-api:1.5.0' // ARouter kapt 'com.alibaba:arouter-compiler:1.5.1' // ARouter api "com.aliyun.dpa:oss-android-sdk:2.9.3" // OSS implementation 'com.jeremyliao:live-event-bus-x:1.7.2' //liveData eventBus implementation 'io.reactivex.rxjava2:rxjava:2.2.14' implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' //endregion //region jetPack 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" implementation "androidx.camera:camera-camera2:1.0.0-beta07" // CameraX 核心库使用 camera2 实现 implementation "androidx.camera:camera-view:1.0.0-alpha14" // 可以使用CameraView implementation "androidx.camera:camera-extensions:1.0.0-alpha14" // 可以使用供应商扩展 implementation "androidx.camera:camera-lifecycle:1.0.0-beta07" //camerax的生命周期库 //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 }