添加依赖:
compile 'org.greenrobot:eventbus:3.1.1'
annotationProcessor 'org.greenrobot:eventbus-annotation-processor:3.1.1'
第一步,修改 app 下面的 build 文件
在 android>>defaultConfig 节点下面增加
javaCompileOptions {
annotationProcessorOptions {
arguments = [ eventBusIndex : 'com.bwie.butterknife.MyEventBusIndex' ]
}
}如图:
ButterKnife依赖:
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'