当我点击setContentView(R.layout.activity_main);并进入生成菜单,“使用butterknife生成注射”选项不存在。我也试过使用shift-command-B快捷键,但它仍然不起作用。我把这两行,我的build.gradle(模块:应用程序)文件Butterknife不会在Android Studio中生成注入
compile 'com.jakewharton:butterknife:8.7.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
我试图重新启动Android Studio中很好,但似乎没有任何工作。感谢任何看到这个的人!
更换
的onCreate()后,你叫ButterKnife.bind(这)? – Thearith
是的。它看起来像这样:@Override 保护无效的onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); } – Erika