千淘万漉虽辛苦,吹尽狂沙始到金

ButterKnife 8.5.1 >>> N

2017-05-02  本文已影响21人  关内侯和他的五百勇士

原因:

没有看清楚添加依赖的正确姿势!!!

解决:

1、如果该 module 仅作为 app 使用:
dependencies { compile 'com.jakewharton:butterknife:8.5.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1' }
2、如果该 module 是作为 library 使用:

root module

buildscript { repositories { mavenCentral() } dependencies { classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1' } }

your module

apply plugin: 'com.android.library' apply plugin: 'com.jakewharton.butterknife'

使用注解时,用 R2 代替 R

class ExampleActivity extends Activity { @BindView(R2.id.user) EditText username; @BindView(R2.id.pass) EditText password; ... }
3、如果 your project 既有 app module, 又有 libary module,则相机使用

上一篇 下一篇

猜你喜欢

热点阅读