原因:
沒有看清楚添加依賴的正確姿勢!??!
解決:
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,則相機(jī)使用