Using Butter Knife in Custom BaseAdapter SubClass Results in “Unable to inject views” error

后端 未结 5 953
甜味超标
甜味超标 2021-02-18 13:59

I\'m attempting to use Butter Knife to simplify creation of a custom BaseAdapter class. I\'m following the example here: http://jakewharton.github.io/butterknife/ under the \"A

5条回答
  •  耶瑟儿~
    2021-02-18 14:05

    Those who are still looking it happens if you are trying to bind wrong View type from XML in Java file it .

    For example

    You have TextView with id result

     
    

    And you try to bind it with Button in java file

    @BindView(R.id.result) Button result;

    It gone crash you app.

    Butterknife will throw exception for illegal casting of views as Unable to Inject View Error

提交回复
热议问题