- R.id.XXX:Resource IDs cannot be
- Resource IDs cannot be used in a
- resource IDS cannot be used in a
- Android ViewBinding 使用
- Constant expression required
- Resource Data structure and algo
- zabbix启动报:cannot set resource li
- Resource IDs will be non-final i
- Android 模块化开发switch-case中用资源ID报错
- pillow使用备忘之OSError: cannot open
原文链接:https://blog.csdn.net/Jay_zjc/java/article/details/90667619
在组件化开发中,当我们使用switch来进行判断操作时,会报这个错误,原因是R.id.XXX这类资源id在主application中是final,是常量,而在library中,是没有final的。
所以我们需要将switch转变为if else,直接选中switch,alt+enter,选择replace switch with if .
网友评论