butterknife zelezny can't show in generate menu for AndroidStudio1.3.1

旧时模样 提交于 2019-12-22 09:46:57

问题


My Android studio version is 1.3.1, When I add the plugin of butterknife zelezny 1.3.2 by the step: download it and install via Preferences → Plugins → Install plugin from disk.

but, failed to show the button of "Generate ButterKnife Injections" in the menu of generate.

what's reason of this issue? How can resolve it? Thanks.


回答1:


  1. restart your AS
  2. right click on R.layout.my_layout
  3. choose generate(or click Alt+Insert)
  4. you may see "generate Butterknife injections" item in the menu



回答2:


I also faced the same .So if am correct you have not added butter knife dependencies in your gradle file.

dependencies {
compile 'com.jakewharton:butterknife:7.0.1'
}

Add this in your projecct build.gradle(Module:app)

Once you are done with you will get Generate ButterKnife Injections option on right click of layout.




回答3:


as @Woi mentioned from above you can do this way.

For Windows you can do the same by following below steps.

1.right click on R.layout.my_layout in activity or fragment

2.Click generate(Alt+Inser)

3.Generate butterknife injection(Ctrl+Shift+B)




回答4:


It works on 7.0.1. Not works on 8.0.1

1.works:

compile 'com.jakewharton:butterknife:7.0.1'

2.not works:

compile 'com.jakewharton:butterknife:8.0.1'



回答5:


My Android studio version is 3.1.2, When I add the plugin of butterknife zelezny 1.6.0 by the step: download it and install via Preferences → Plugins → Browse repositories and search for ButterKnife Zelezny.

I had this same issue. I resolved it by adding classpath 'com.jakewharton:butterknife-gradle-plugin:8.8.1' to my gradle build file at project level so that it's buildscript section looks like:

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

https://github.com/JakeWharton/butterknife README.md is uesful.




回答6:


I had this same issue but restarting didn't fix it. I resolved it by adding classpath 'com.jakewharton:butterknife-gradle-plugin:8.7.0' to my gradle build file at project level so that it's buildscript section looks like

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        ...
        classpath 'com.jakewharton:butterknife-gradle-plugin:8.7.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

Secondly, to see the "Generate ButterKnife Injections" in the menu, you'll need to focus the mouse cursor on the layout file and right-click on it then select "Generate".

e.g. in Fragment, View v = inflater.inflate(R.layout.fragment_create_new_order, container, false); right click on "fragment_create_new_order" and select "Generate"



来源:https://stackoverflow.com/questions/32252111/butterknife-zelezny-cant-show-in-generate-menu-for-androidstudio1-3-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!