JavaShuo
栏目
标签
Resource IDs cannot be used in a switch statement in Android library modules.
时间 2021-07-10
栏目
Android
繁體版
原文
原文链接
在组件化开发中,当我们使用switch来进行判断操作时,会报这个错误,原因是R.id.XXX这类资源id在主application中是final,是常量,而在library中,是没有final的。这里盗个图: 所以我们需要将switch转变为if else,直接选中switch,alt+enter,选择replace switch with if .
>>阅读原文<<
相关文章
1.
【Android 报错】Resource IDs cannot be used in a switch statement in Android library modules
2.
Resource IDs cannot be used in a switch statement in Android library modules
3.
Android开发问题之--Validates using resource IDs in a switch statement in Android library module
4.
require function is used in a way in which dependencies cannot be statically extracted
5.
Constructor call must be the first statement in a constructor
6.
Cannot execute statement in a READ ONLY transaction.
7.
[django] Exception Value: DatabaseWrapper objects created in a thread can only be used in that s...
8.
[django] Exception Value: DatabaseWrapper objects created in a thread can only be used in that same
9.
The type OneInterface cannot be a superinterface of OneInterfaceImpl; a superinterface must be an in
10.
Codelab for Android Design Support Library used in I/O Rewind Bangkok session
更多相关文章...
•
SQL IN 操作符
-
SQL 教程
•
Swift for-in 循环
-
Swift 教程
•
JDK13 GA发布:5大特性解读
•
Kotlin学习(一)基本语法
相关标签/搜索
method...in
in+exists
in&&exists
for...in
for..in
for.....in
In PHP
between+in
modules
ids
Android
0
分享到微博
分享到微信
分享到QQ
每日一句
每一个你不满意的现在,都有一个你没有努力的曾经。
最新文章
1.
1.2 Illustrator多文档的几种排列方式
2.
5.16--java数据类型转换及杂记
3.
性能指标
4.
(1.2)工厂模式之工厂方法模式
5.
Java记录 -42- Java Collection
6.
Java记录 -42- Java Collection
7.
github使用
8.
Android学习笔记(五十):声明、请求和检查许可
9.
20180626
10.
服务扩容可能引入的负面问题及解决方法
本站公众号
欢迎关注本站公众号,获取更多信息
相关文章
1.
【Android 报错】Resource IDs cannot be used in a switch statement in Android library modules
2.
Resource IDs cannot be used in a switch statement in Android library modules
3.
Android开发问题之--Validates using resource IDs in a switch statement in Android library module
4.
require function is used in a way in which dependencies cannot be statically extracted
5.
Constructor call must be the first statement in a constructor
6.
Cannot execute statement in a READ ONLY transaction.
7.
[django] Exception Value: DatabaseWrapper objects created in a thread can only be used in that s...
8.
[django] Exception Value: DatabaseWrapper objects created in a thread can only be used in that same
9.
The type OneInterface cannot be a superinterface of OneInterfaceImpl; a superinterface must be an in
10.
Codelab for Android Design Support Library used in I/O Rewind Bangkok session
>>更多相关文章<<