Butter Knife return null pointer

In your onCreate method, make sure you have the line:

ButterKnife.bind(this);

Without that line, the binds you set up aren't performed, and the views remain null.


I fixed it.

There is a problem with my build.gradle

I forgot to add

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

to the build.gradle

Thank everyone

UPDATE

If you are using neenbedankt.android-apt plugin first remove it.

Then remove apt 'com.jakewharton:butterknife-compiler:8.0.1'

And then add annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' to the dependencies.

UPDATE 2

If you are using kotlin replace :

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

with:

kapt 'com.jakewharton:butterknife-compiler:8.8.1'

And don't forget to add

apply plugin: 'kotlin-kapt'

after:

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'