Why do I have problems whith 'com.jakewharton:butterknife:7.0.1' in Android Studio 3.0?

喜欢而已 提交于 2019-12-05 12:12:00

Annotation processors must be explicitly declared now

Do what it says

Add the second line

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

With 8.7.0 ... it generates more problems in my LogginActivity:

You are importing the wrong class...

Annotate fields with @BindView

That changed at Version 8.0

See the website for usage and the latest version. http://jakewharton.github.io/butterknife/

import butterknife.BindView;

..

@BindView(R.id...)

you can solve this issue by simply adding this to your app level gradle file

android{
....
    defaultConfig{
....
    javaCompileOptions {
        annotationProcessorOptions {
            includeCompileClasspath true
        }
    }
}

Hope its worked

You can try :

// butter knife
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

Otherwise you can try

https://github.com/avast/android-butterknife-zelezny

to auto gencode from butterknife.

I hope it can help your problem!

Just add this line:

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

in your dependencies like:

dependencies {
    //...
    compile 'com.jakewharton:butterknife:7.0.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:7.0.1'
}

Check this out for more details.

try this ,you need to add the annotation along with ButterKnife library..

Butterknife library

 compile 'com.jakewharton:butterknife:8.8.1'

annotation for butterknife

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