简体   繁体   中英

Butterknife won't generate injections in Android Studio

When I click on setContentView(R.layout.activity_main); and go to the generate menu, the "generate injections using butterknife" option is not there. I also tried using the shift-command-B shortcut but it still doesn't work. I put these two lines in my build.gradle (Module:app) file

compile 'com.jakewharton:butterknife:8.7.0'

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

I tried restarting Android Studio as well but nothing seems to work. Thanks to anyone who sees this!

You can try installing a plugin. See this link https://github.com/avast/android-butterknife-zelezny/issues/98

try to replace

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

with

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

OPTION 1:

In Android Studio:

 1. File -> Settings -> Plugins -> Browse repositories

 2. Search and install 'Android ButterKnife Zelezny'

 3. Restart Android Studio

OPTION 2:

If you can't find it in Browse repositories, then download plugin (link below) and install it manually via "install from disk"

Link for plugin: http://plugins.jetbrains.com/plugin/7369-android-butterknife-zelezny

Link for project: https://github.com/avast/android-butterknife-zelezny

So if you want add butter knife add all dependency related to this and

* Important Go to setting and then go plugin, search butter knife and install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM