常见依赖与版本管理
阿里云 gradle
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
常见配置
//androidx迁移表
https://blog.csdn.net/gengkui9897/article/details/102114493
1.基本配置
androidx版本
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
android版本
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation fileTree(include: ['*.jar'], dir: 'libs') androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations'}) implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:cardview-v7:28.0.0' implementation 'com.android.support:recyclerview-v7:28.0.0' testImplementation 'junit:junit:4.12'
2.0 其他配置
androidx版本
androidd版本
apply plugin: 'com.android.application'apply from: 'config.gradle'android { compileSdkVersion 28 defaultConfig { applicationId "com.deviche.common.mvpdemo" minSdkVersion 15 targetSdkVersion 28 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }}dependencies {// ———————————————禁止使用androidx——————————————————————————— implementation fileTree(include: ['*.jar'], dir: 'libs') androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:cardview-v7:28.0.0' implementation 'com.android.support:recyclerview-v7:28.0.0' testImplementation 'junit:junit:4.12'// ---------------------------------------------------- implementation 'com.squareup.okhttp3:okhttp:3.12.2'// implementation 'io.reactivex:rxjava:1.1.9' implementation 'io.reactivex:rxandroid:1.2.1' implementation 'com.squareup.retrofit2:retrofit:2.1.0' implementation 'com.squareup.retrofit2:converter-gson:2.1.0' implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0' implementation 'com.squareup.retrofit2:retrofit-converters:2.1.0' implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1' implementation 'com.alibaba:fastjson:1.2.10'//fastjson implementation 'org.greenrobot:eventbus:3.1.1' //图片加载 implementation 'com.github.bumptech.glide:glide:3.7.0' //下拉刷新 implementation('cn.bingoogolapple:bga-refreshlayout:1.1.8') { exclude group: 'com.android.support' } //注解 implementation 'com.jakewharton:butterknife:8.5.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1' //沉浸式状态栏 implementation 'com.readystatesoftware.systembartint:systembartint:1.0.3' //图片查看 implementation('com.commit451:PhotoView:1.2.4') { exclude group: 'com.android.support' } implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.47' implementation 'com.blankj:utilcode:1.25.9' implementation 'org.greenrobot:eventbus:3.1.1'// +++++++++++++++++++++++++++++ okgo ++++++++++++++++++++++++ //必须使用 implementation 'com.lzy.net:okgo:3.0.4'//以下三个选择添加,okrx和okrx2不能同时使用 implementation 'com.lzy.net:okrx:1.0.2'// implementation 'com.lzy.net:okrx2:2.0.2'// implementation 'com.lzy.net:okserver:2.0.5' //RxPermissions implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.4@aar' //RxJava2 implementation "io.reactivex.rxjava2:rxjava:2.2.8"// -----------------------------rxhttp,网络框架二选一----------------------------------------- implementation('com.rxjava.rxhttp:rxhttp:1.3.6') { //xxx为RxHttp最新版本 exclude group: "com.squareup.okhttp3" }//注解处理器,生成RxHttp类,即可一条链发送请求 annotationProcessor 'com.rxjava.rxhttp:rxhttp-compiler:1.3.6'//管理RxJava及生命周期,Activity/Fragment 销毁,自动关闭未完成的请求 implementation 'com.rxjava.rxlife:rxlife:1.1.0'//非必须 根据自己需求选择Converter RxHttp默认内置了GsonConverter// implementation 'com.rxjava.rxhttp:converter-jackson:1.3.6' implementation 'com.rxjava.rxhttp:converter-fastjson:1.3.6'// implementation 'com.rxjava.rxhttp:converter-protobuf:1.3.6'// implementation 'com.rxjava.rxhttp:converter-simplexml:1.3.6'// ------------------------------------rxhttp------------------------------------------------}
网友评论