retrofit2
compile 'com.squareup.retrofit2:retrofit:2.0.0' compile 'com.google.code.gson:gson:2.6.2' compile 'com.squareup.retrofit2:converter-gson:2.0.0'
dagger2
compile 'com.google.dagger:dagger:2.4' annotationProcessor 'com.google.dagger:dagger-compiler:2.4' //java注解 // compile 'org.glassfish:javax.annotation:10.0-b28'
rxjava/rxandroid
compile 'io.reactivex:rxjava:1.0.14' compile 'io.reactivex:rxandroid:1.0.1'
butterknife
compile 'com.jakewharton:butterknife:8.5.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'LeakCanary
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.2'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.2'
public class LeakApplication extends Application {
@Override public void onCreate() { super.onCreate();
if (!LeakCanary.isInAnalyzerProcess(this)) { LeakCanary.install(this); } }}
如果在fragment需要在onDestroy方法获取application中的RefWatcher,并注册refWatcher.watch(this);
EventBus
compile 'org.greenrobot:eventbus:3.0.0'
RoundImageview
compile 'com.makeramen:roundedimageview:2.3.0'
FlowLayout 流式布局(历史搜索)
compile 'com.nex3z:flow-layout:0.1.2'
PermissionGen 权限处理
compile 'com.lovedise:permissiongen:0.0.6'
图片加载框架
compile 'com.squareup.picasso:picasso:2.5.2'
XRecycleView
compile 'com.jcodecraeer:xrecyclerview:1.3.2'
条目分割
MyItemDecoration extends RecyclerView.ItemDecoration { private final int lineNum; private int space; public HomeItemDecoration(int lineNum, int space) { this.space = space; this.lineNum = lineNum; } @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { //不是第一个的格子都设一个左边和底部的间距 outRect.left = space; outRect.bottom = space;}}
Glide(图片加载框架)
compile 'com.github.bumptech.glide:glide:4.6.1'
//如果需要生成 extends APPGlideModule(加@GlideModule注解)生成代码,以便实现链式编程,需要添加下面的依赖 annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
Mockito 单元测试框架
testCompile "org.mockito:mockito-core:2.+"
或者
testCompile "org.mockito:mockito-core:+" androidTestCompile "org.mockito:mockito-android:+"
参考网址 https://static.javadoc.io/org.mockito/mockito-core/2.16.0/org/mockito/Mockito.html
rxjava + retrofit + okhttp
compile 'io.reactivex.rxjava2:rxjava:2.0.7' compile 'io.reactivex.rxjava2:rxandroid:2.0.1' compile 'com.squareup.retrofit2:retrofit:2.1.0' compile 'com.squareup.retrofit2:adapter-rxjava2:2.2.0' compile 'com.squareup.retrofit2:converter-gson:2.1.0' compile 'com.squareup.okhttp3:okhttp:3.5.0' compile 'com.squareup.okhttp3:logging-interceptor:3.6.0' packagingOptions { // exclude 'META-INF/services/javax.annotation.processing.Processor' exclude 'META-INF/rxjava.properties' }