github地址:https://github.com/JakeWharton/u2020
该项目是Jack Wharton牵头完成的关于dagger的使用例子,gradle里引入包如下:
dependencies {
compile 'com.android.support:support-v4:19.0.+'
compile 'com.squareup.dagger:dagger:1.2.1' //dagger包
provided 'com.squareup.dagger:dagger-compiler:1.2.1' //dagger编译器
compile 'com.squareup.okhttp:okhttp:1.3.0' //用于网络请求
compile 'com.squareup.picasso:picasso:2.2.0' //用于图片加载
compile 'com.squareup.retrofit:retrofit:1.4.1' //网络交互开源框架
debugCompile 'com.squareup.retrofit:retrofit-mock:1.4.1' //用于测试
compile 'com.jakewharton:butterknife:4.0.1' //注解工具,类似于roboguice
compile 'com.jakewharton.timber:timber:2.2.2' //日志工具,可以直接将日志提交到服务端
debugCompile 'com.jakewharton.madge:madge:1.1.1' //用于测试
debugCompile 'com.jakewharton.scalpel:scalpel:1.1.1' //用于测试
compile 'com.netflix.rxjava:rxjava-core:0.16.1' //rxjava,反应性编程
compile 'com.netflix.rxjava:rxjava-android:0.16.1'
compile 'com.etsy.android.grid:library:1.0.3' //瀑布流自定义控件
}
需要注意的地方是,src->debug和src->main和src->release三个包分别对应调试版本,main版本,释放版本,在DebugU2020Module类下面有一段代码:
@Module(
addsTo = U2020Module.class,