以下错误本人经历两次了,痛苦地记录一下吧
Caused by: java.lang.IllegalStateException: Required view 'rv_content' with ID 2131297021 for field 'rvContent' was not found. If this view is optional add '@Nullable' (fields) or '@Optional' (methods) annotation.
此异常,编译不会产生,只有在运行时才会产生。
产生原因:组件化过程中,一个模块中的activity或是fragment移动到了另一个模块,没有重新对R和R2导包,导致ButterKnife绑定发生错乱,无法找到正确的id。
解决办法:重新导包即可。导入新模块的包名。