Home > Software engineering >  AnnotationTypeMismatchException in Butterknife @BindView with layouts defined in another folder stru
AnnotationTypeMismatchException in Butterknife @BindView with layouts defined in another folder stru

Time:10-30

While working on a project recently, As the layouts was adding up so many xml's, I added subfolders to layout resources to make the project structured, But after that ButterKnife Injections are not working. I am getting the following error.

@BindView(R.id.tb_tvcoinsMainCommon) TextView tvCoins;
                     ^
  
java.lang.annotation.AnnotationTypeMismatchException: Incorrectly typed data found for annotation element public abstract int butterknife.BindView.value() (Found data of type <any>)

findViewById() is not giving any issues, only ButterKnife Bindings are giving issues. If anybody has a solution that would be helpful

CodePudding user response:

Add annotation @Nullable before @Bind of the view that might be null.

Example : New layout files structure

  • Related