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.
【Java8新特性_尚硅谷】P1_P5
2.
SpringSecurity 基礎應用
3.
SlowFast Networks for Video Recognition
4.
074-enable-right-click
5.
WindowFocusListener窗體焦點監聽器
6.
DNS部署(二)DNS的解析(正向、反向、雙向、郵件解析及域名轉換)
7.
Java基礎(十九)集合(1)集合中主要接口和實現類
8.
瀏覽器工作原理學習筆記
9.
chrome瀏覽器構架學習筆記
10.
eclipse引用sun.misc開頭的類
本站公眾號
歡迎關注本站公眾號,獲取更多信息
相關文章
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
>>更多相關文章<<