Search code examples
androidgradleandroid-gradle-pluginbutterknife

ButterKnife error: cannot find symbol method findRequiredViewAsType


I'm using ButterKnife for along time. But I have error which see for first time and didnt find solution for this.

ERROR:

Error:(24, 36) error: cannot find symbol method findRequiredViewAsType(Object,int,String,Class<ImageView>)

I tried bindView like always

@BindView(R.id.menu_hamburgerIcon) ImageView menuHamburger;

Also added in gradle:

   compile 'com.jakewharton:butterknife:8.0.1'
    apt 'com.jakewharton:butterknife-compiler:8.1.0'

But still getting this error in genereted class by ButterKnife.


Solution

  • You have:

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

    but

    compile 'com.jakewharton:butterknife:8.0.1'
    

    The trick here is that you must use the same version in both entries and you got 8.0.1 and 8.1.0 (most likely C&P or typo), Just set compile to 8.1.0 too and you should be good:

    compile 'com.jakewharton:butterknife:8.1.0'