0
点赞
收藏
分享

微信扫一扫

Android kotlin 开发推荐优秀三方库

产品喵dandan米娜 2022-03-11 阅读 62

在用java开发Android的时候有很多方便的库如:butterknife,rxjava等,但kotlin的使用很多原来java上方便的库,在kotlin上不再方便。


  1. 替换butternife更好工具

在Gralde中配置:

apply plugin: 'kotlin-android-extensions'

之后可以kotlin 快速导入view


  1. 快速序列化

apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
androidExtensions {
experimental = true
}
}

实体
@Parcelize data class MyData(var message:String,var hehehe: Boolean,var temp :Int):Parcelable

  1. Autopage Android快捷跳转ui库 快捷的

project : build.gradle 项目的gradle配置

buildscript {
repositories {
maven { url 'https://www.jitpack.io' }
}

项目里配置

apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
androidExtensions {
experimental = true
}
}

kapt com.github.smartbackme.AutoPage:autopage-processor:1.0.7
implementation com.github.smartbackme.AutoPage:autopage:1.0.7

就可以实现页面急速跳转

ApMainActivity2.newInstance().apply {
message = "123"
} .start(this)

github地址:​​https://github.com/smartbackme/AutoPage​​


  1. leakcanary---内存检测工具

debugImplementation com.squareup.leakcanary:leakcanary-android:2.0-beta-1

github地址:​​https://www.github.com/square/leakcanary​​


  1. Logger---支持多种类型数据打印

implementation 'com.orhanobut:logger:2.2.0'

github地址:​​https://github.com/orhanobut/logger​​


  1. Retrofit 方便的网络请求,结合kotlin协程
    github地址:​​​​https://github.com/square/retrofit​​​​

implementation 'com.squareup.retrofit2:retrofit:2.9.0'

  1. okhttp 网络请求库

github地址:​​https://github.com/square/okhttp​​


  1. glide 图片请求库,okhttp可加持

github地址:​​https://github.com/bumptech/glide​​


  1. MMKV 替代SharePreference的高性能key-value组件
    github地址:​​​​https://github.com/tencent/mmkv​​​​

dependencies {
implementation 'com.tencent:mmkv:1.0.23'
}

  1. SmartRefreshLayout 下拉刷新、上拉加载非常好用

github地址:​​https://github.com/scwang90/SmartRefreshLayout/​​


  1. ImmersionBar 沉浸式状态栏
    github地址:​​​​https://github.com/gyf-dev/immersionbar​​​​

  2. BaseRecyclerViewAdapterHelper 非常好用Recyvlerview适配器
    github地址:​​​​https://github.com/CymChad/BaseRecyclerViewAdapterHelper​​​​


举报

相关推荐

0 条评论