2017-07-15 23 views
0

当我点击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中很好,但似乎没有任何工作。感谢任何看到这个的人!

+0

更换

annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0' 

的onCreate()后,你叫ButterKnife.bind(这)? – Thearith

+0

是的。它看起来像这样:@Override 保护无效的onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); } – Erika

回答

0

你可以尝试安装一个插件。看到此链接https://github.com/avast/android-butterknife-zelezny/issues/98

+0

欢迎您访问解决方案的链接,但请确保您的答案在没有它的情况下很有用:[在链接中添加上下文](https://meta.stackexchange.com/questions/8231/are-answers-that-just 8259),所以你的同行用户会有一些想法是什么,为什么它在那里,然后引用你链接到的页面最相关的部分,以防万一目标页面不可用。 [仅仅是一个链接的答案可能会被删除。](https://stackoverflow.com/help/deleted-answers) – Dwhitz

0

尝试

apt 'com.jakewharton:butterknife-compiler:8.7.0' 
相关问题