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

孤人 提交于 2019-12-05 19:04:12
  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

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.

Muhaiminur Rahman

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)

Zach Chen

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'
Languoguang

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.

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"

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