ButterKnife 8.0.1 not working

前端 未结 10 1205
粉色の甜心
粉色の甜心 2020-12-05 16:42

I am using butterknife 8.0.1, but a nullpointerexception is appearing.

This line is on my build.grade file: compile \'com.ja

10条回答
  •  孤街浪徒
    2020-12-05 17:33

    I used this library in Fragment and has NPE. My code was:

    ButterKnife.bind(view);
    

    But it was wrong. Library need to know two objects:
    1) Target - with annotations @BindView
    2) Source - with views

    It will be right to write:

    ButterKnife.bind(this, view);
    

    When this - your fragment, and view - view of this fragment.

提交回复
热议问题