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.
以實例說明微服務拆分(以SpringCloud+Gradle)
2.
idea中通過Maven已經將依賴導入,在本地倉庫和external libraries中均有,運行的時候報沒有包的錯誤。
3.
Maven把jar包打到指定目錄下
4.
【SpringMvc】JSP+MyBatis 用戶登陸後更改導航欄信息
5.
在Maven本地倉庫安裝架包
6.
搭建springBoot+gradle+mysql框架
7.
PHP關於文件$_FILES一些問題、校驗和限制
8.
php 5.6連接mongodb擴展
9.
Vue使用命令行創建項目
10.
eclipse修改啓動圖片
本站公眾號
歡迎關注本站公眾號,獲取更多信息
相關文章
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
>>更多相關文章<<