代码拉取完成,页面将自动刷新
同步操作将从 zhuGdu/JetpackOfCainiao 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
//统一配置一些共用参数
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'//kotlin语言使用注入框架,dataBinding都需要这个
apply plugin: 'androidx.navigation.safeargs.kotlin'//用于navigation传参的时候一种安全防护
apply plugin: 'koin'
android {
compileSdkVersion compile_sdk_version
buildToolsVersion build_tools_version
defaultConfig {
minSdkVersion min_sdk_version
targetSdkVersion target_sdk_version
versionCode lib_version_code
versionName lib_version_name
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
//java中的配置
// javaCompileOptions {
// annotationProcessorOptions {
// //生成schema文件,便于查看数据库创建表的详细信息
// 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())
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
//AndroidStudio4.0 以下使用这种配置dataBinding
// dataBinding {
// enabled = true
// }
//AndroidStudio4.0 以上版本使用这个配置dataBinding
buildFeatures {
dataBinding = true
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
// work-runtime-ktx 2.1.0 and above now requires Java 8
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs+=["-Xopt-in=kotlin.RequiresOptIn",] //使用kotlin新特性
}
}
//创建一个dependencies管理的文件,可以在各自module的build.gradle文件里,apply form 该文件的相对路径(包含fileName),如 apply form ../dependencies.gradle
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.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.0"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.fragment:fragment-ktx:1.2.4'
implementation 'androidx.activity:activity-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta8'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
//endregion
//region jetPack libs
// implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' //已被废弃,详见demo
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-alpha07'
implementation 'androidx.paging:paging-common:3.0.0-alpha07'
implementation 'androidx.work:work-runtime:2.3.4'
implementation 'androidx.work:work-runtime-ktx:2.3.4'
//注意配置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"
//endregion
//region test libs
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.1'
androidTestImplementation 'androidx.test:core:1.2.0'
androidTestImplementation 'androidx.test:core-ktx:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//endregion
//region koin框架
//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 ARouter
implementation 'com.alibaba:arouter-api:1.5.0'
kapt 'com.alibaba:arouter-compiler:1.2.2'
//liveData eventBus
implementation 'com.jeremyliao:live-event-bus-x:1.7.2'
//endregion
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。