Using Butter Knife in Custom BaseAdapter SubClass Results in "Unable to inject views" error Using Butter Knife in Custom BaseAdapter SubClass Results in "Unable to inject views" error android android

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


Check if your @InjectViews has correct type. I've used ImageView instead of LinearLayout. That might be your problem too.

Update:

Make sure you are not using ButterKnife's @OnItemClick(R.id.non_list_view) with a non ListView. I was using it for a android.support.v7.widget.RecyclerView which was causing following exception:

java.lang.RuntimeException: Unable to inject views for MyFragment{... id=.... android:switcher:...}


Also check if you are inflating correct R.layout. file. If not - necessary views are not found and this error occurs.


I had a similar problem with ButterKnife, but the reason was that I was inflating my fragment with the wrong layout.

(I know the question was already answered, but I decided to post my solution in case someone had the same issue)