常用库,本地gradle和阿里云,关联library

//okhttp

implementation 'com.squareup.okhttp3:okhttp:3.10.0'

implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0' //日志拦截器

//retrofit

implementation"com.squareup.retrofit2:retrofit:2.3.0"

implementation"com.squareup.retrofit2:converter-gson:2.3.0"  //Gson

implementation 'com.squareup.retrofit2:adapter-rxjava2:3.0'

//rxjava2,切记区分rxjava与rajava2的api区别,

//rxjava2要切换线程, 使用RxJava2CallAdapterFactory

    implementation 'io.reactivex.rxjava2:rxjava2:2.0.4'               

//implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'

//glide

implementation 'com.github.bumptech.glide:glide:4.5.0'                      annotationProcessor 'com.github.bumptech.glide:compiler:4.5.0'

//butterknife

implementation 'com.jakewharton:butterknife:10.1.0'                                    annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'

//eventbus3.0

implementation 'org.greenrobot:eventbus:3.0.0'

implementation 'com.google.code.gson:gson:2.7'

//rxhttp                                                                                                                         implementation 'com.ljx.rxhttp:rxhttp:2.5.7'                                                               implementation 'com.squareup.okhttp3:okhttp:4.9.1'                                                               kapt 'com.ljx.rxhttp:rxhttp-compiler:2.5.7'

//BRVAH

implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4'

//  轮播图  banner

implementation 'com.youth.banner:banner:1.4.10' 


泛型类型参数化

System.out.println(Parent.class.getName()); System.out.println(Parent.class.getTypeParameters()[0].getName()); System.out.println(Child.class.getGenericSuperclass().getTypeName()); System.out.println( Child.class.getGenericSuperclass().getClass().getTypeParameters().length); System.out.println( Child.class.getGenericSuperclass() instanceof ParameterizedType);

设置本地gradle

distributionUrl=file:///F:/android-studio/gradle/gradle-4.4-all.zip


修改阿里云镜像

maven { url 'https://maven.aliyun.com/repository/public/' }

添加华为镜像

maven { url 'https://mirrors.huaweicloud.com/repository/maven/' }

maven { url 'https://developer.huawei.com/repo/' }

关联library

implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation project(':lib')

rxjava2用法

observerable.create.subscribeon.observeon.observe


//jetpack全家桶依赖

//协程                                                                                                                      implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9'                 implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'                     //Android KTX 是一组 Kotlin 扩展程序,属于 Android Jetpack 系列             implementation 'androidx.core:core-ktx:1.3.2'                                                 implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0'                         implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'                      implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'                                                 implementation 'com.github.fmtjava:LiveDataBus:1.0.0'

//协程 + room                                                                                                        implementation "androidx.room:room-runtime:2.2.5"                                                         kapt "androidx.room:room-compiler:2.2.5"                                                     implementation "androidx.room:room-ktx:2.2.5"                                                     //navigation                                                                                                             implementation "androidx.navigation:navigation-fragment-ktx:2.3.1"             implementation "androidx.navigation:navigation-ui-ktx:2.3.1"                                     //paging                                                                                                                 implementation "androidx.paging:paging-runtime:3.0.0-alpha09"             //WorkManager                                                                                                     implementation "androidx.work:work-runtime-ktx:2.4.0" //koin(依赖注入)                 implementation "org.koin:koin-androidx-scope:2.0.1"                                             implementation "org.koin:koin-androidx-viewmodel:2.0.1"

implementation "org.koin:koin-androidx-ext:2.0.1" 

找源码中接口的实现类:ctrl+h,会显示继承树结构

写插件实现mvp等模板代码一键生成

Thread.dumpStack()来查看调用栈。

设置activity全屏显示 两种方法,注意只在ACtivity生效,继承自AppCompatActivity还需要设置theme

      1.  android:theme=" @android :style/Theme.NoTitleBar.Fullscreen"

     2.  setcontentview之前调用

             this.requestWindowFeature(Window.FEATURE_NO_TITLE);

                                         this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,  WindowManager.LayoutParams.FLAG_FULLSCREEN);

...

val binding = DataBindingUtil.setContentView(this,R.layout.activity_main)

这一句里面的泛型类名称由activity_main的名称这里决定

As421 新项目注意右键 open module setting 改jdk版本

安卓项目根目录右键 Local history,可以展示本地修改,可以批量回滚代码

aaabbb改成bbbaaa,选中bbb并按住鼠标左键向前整体拖动

你可能感兴趣的:(常用库,本地gradle和阿里云,关联library)