1. 程式人生 > >Error: This attribute must be localized. 解決方法

Error: This attribute must be localized. 解決方法

FROM:http://blog.csdn.net/qinyun188/article/details/7466973

在使用mmm單獨編譯Android應用程式時出現如下錯誤:

mmm packages/apps/BoardconLED/
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.3.4
TARGET_PRODUCT=idea6410
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=

Linux
HOST_BUILD_TYPE=release
BUILD_ID=GRJ22
============================================
make: Entering directory `/home/cheyan/android/6410/sbc6410_android2.3.4_20120315'
target R.Java/Manifest.java: BoardconLedTest (out/target/common/obj/APPS/BoardconLedTest_intermediates/src/R.stamp)
res/layout/main.xml.bak:0: error: Resource entry main is already defined.
res/layout/main.xml:0: Originally defined here.
packages/apps/BoardconLED/res/values/strings.xml.bak:4: error: Resource entry app_name is already defined.
packages/apps/BoardconLED/res/values/strings.xml:3: Originally defined here.
packages/apps/BoardconLED/res/layout/main.xml.bak:8: error: Error: This attribute must be localized. (at 'text' with value 'on').
packages/apps/BoardconLED/res/layout/main.xml.bak:17: error: Error: This attribute must be localized. (at 'text' with value 'led1').
packages/apps/BoardconLED/res/layout/main.xml.bak:26: error: Error: This attribute must be localized. (at 'text' with value 'led2').
packages/apps/BoardconLED/res/layout/main.xml.bak:35: error: Error: This attribute must be localized. (at 'text' with value 'led3').
packages/apps/BoardconLED/res/layout/main.xml.bak:44: error: Error: This attribute must be localized. (at 'text' with value 'led4').
packages/apps/BoardconLED/res/layout/main.xml.bak:53: error: Error: This attribute must be localized. (at 'text' with value 'off').
packages/apps/BoardconLED/res/layout/main.xml.bak:62: error: Error: This attribute must be localized. (at 'text' with value 'on').
packages/apps/BoardconLED/res/layout/main.xml.bak:71: error: Error: This attribute must be localized. (at 'text' with value 'off').
packages/apps/BoardconLED/res/layout/main.xml.bak:80: error: Error: This attribute must be localized. (at 'text' with value 'on').
packages/apps/BoardconLED/res/layout/main.xml.bak:89: error: Error: This attribute must be localized. (at 'text' with value 'off').
packages/apps/BoardconLED/res/layout/main.xml.bak:98: error: Error: This attribute must be localized. (at 'text' with value 'on').
packages/apps/BoardconLED/res/layout/main.xml.bak:107: error: Error: This attribute must be localized. (at 'text' with value 'off').
packages/apps/BoardconLED/res/layout/main.xml.bak:116: error: Error: This attribute must be localized. (at 'text' with value 'All on').
packages/apps/BoardconLED/res/layout/main.xml.bak:125: error: Error: This attribute must be localized. (at 'text' with value 'All off').
make: *** [out/target/common/obj/APPS/BoardconLedTest_intermediates/src/R.stamp] Error 1
make: Leaving directory `/home/cheyan/Android/6410/sbc6410_android2.3.4_20120315'

“This attribute must be localized”,這種問題一般情況是因為在res/layout下的檔案中出現了沒有多語言話的文字例如

<Button
android:id="@+id/btnLED1On"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="on"
android:layout_x="8px"
android:layout_y="42px"
>
</Button>

解決辦法:

res/values/strings.xml中定義字串


<string name="led1on">on</string>

然後再把res/layout/main.xml相應內容改成

<Button
android:id="@+id/btnLED1On"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@sring/led1on"
android:layout_x="8px"
android:layout_y="42px"
>
</Button>

這是android強制實行多語言話,是為了方便應用多言版本的擴充。

PS:在使用mmm編譯的時候解決這類報錯的方法是:

將對應xml裡使用的字串改用引用strings.xml裡的tag就可以了, 

這是android強制實行多語言話,是為了方便應用多言版本的擴充!!! 

================================================================================================

This attribute must be localized.錯誤解決方式

FROM:https://www.oschina.net/question/163910_27978

eclipse中編譯沒有問題,但是在make自己建立的專案的時候,提示了錯誤“This attribute must be localized”,這種問題一般情況是因為在res/xml資料夾下的中或者在res/layout下的檔案中出現了沒有多語言話的文字例如 

<TextViewandroid:id="@+id/myTextView1"android:text="type"android:layout_width="fill_parent">
</TextView>
解決方式:在res/values/strings.xml中定義字串 
<stringname="str_type">type</string>
然後把上面的內容改為 
<TextViewandroid:id="@+id/myTextView1"android:text="@string/str_type"android:layout_width="fill_parent">
</TextView>
這是android強制實行多語言話 

相關推薦

Error: This attribute must be localized. 解決方法

FROM:http://blog.csdn.net/qinyun188/article/details/7466973 在使用mmm單獨編譯Android應用程式時出現如下錯誤: mmm packages/apps/BoardconLED/ =============

haoxin is not in the sudoers file. This incident will be reported 解決方法

alt src family nbsp font ges 添加 repo 技術 編輯文件/etc/sudoers 文件,在該文件裏面找到 然後在這一行下面添加 haoxin ALL=(ALL) ALL haoxin is not in the sud

解決python使用images2gif模組時候報錯:Type error Argument 1 must be string or buffer not none

    最近對圖片處理這一塊比較感興趣,無意間發現python裡面有一個很好玩的庫叫做images2gif,可以實現將多個靜態的圖片合稱為一個動態GIF圖,諸如鬥圖網中的那樣,這個無意是一個鬥圖神器啊(開玩笑哈),不過模組好用是真的,看到網上很多人都是使用它做各種各樣漂亮的動

Git初學使用記錄fatal: this operation must be run in a work tree解決辦法

fatal: this operation must be run in a work tree $ git add test.txt fatal: this operation must be run in a work tree 解決辦法 原因是我們把t

VC6.0報錯:"Error spawning 'vcspawn.exe'. The build could not be performed"解決方法 (2011-05-05 10:14:50)

很長時間沒有使用VC6.0.今天有個程式需要在VC6.0下編譯,結果出現了這個報錯,在網上找了一通,按照他們的方法搞了一通也沒有解決,我畢竟身經百戰,自己思考了一下,還是解決了.做下面的一些工作,基本上可以解決: 1.設定系統環境變數:ComSpec=C:\Wi

嚴重: Error loading WebappClassLoader context:異常的解決方法(轉)

需要 oca 選擇 tom png servers .net -i ati Eclipse的web工程至Tomcat默認的部署目錄是在工程空間下,本文旨在將部署目錄改為Tomcat安裝目錄,並解決依賴包輸出問題。1.在Eclipse中添加Tomcat服務器。2.將web工程

創建django項目出現AttrbuteError module 'pip' has no attribute 'main'解決方法

python -- alt tee nal internal import ring 兩種 由於升級pip到10.0,創建django出現AttrbuteError module ‘pip‘ has no attribute ‘main‘錯誤,解決方法有兩種 一:找到/Ap

npm install 報錯(npm ERR! errno -4048,Error: EPERM: operation not permitted,)解決方法

win npm support comm project 需要 event sin 命令 npm ERR! path E:\SouthernPowerGridProject\web_project\AutoOPS\autoops\node_modules\fsevents\

Linux下使用Python連接Oracle 報cx_Oracle.DatabaseError: DPI-1047: 64-bit Oracle Client library cannot be loaded解決方法

iter onf brush enc extern base 分別是 port clas 在Linux上使用python運行數據庫腳本的時候報:cx_Oracle.DatabaseError: DPI-1047: 64-bit Oracle Client library c

Linux中新建用戶用不了sudo命令問題:rootr is not in the sudoers file.This incident will be reported解決

c-c++ 進入 去掉註釋 去掉 sudo命令 wheel gpasswd sdn 通用 參考:https://blog.csdn.net/lichangzai/article/details/39501025 如果執行sudo命令的用戶沒有執行sudo的權限,執行su

Server Host Cannot be null解決方法

設置 錯誤 can 運行 一個 server 新的 問題 service 在用打開Services Directory application 或者訪問 某個已發布的地圖服務時,出現"Server Host Cannot be null"的錯誤。 問題的原因在於

Python指令碼報錯:AttributeError:'model' object has no attribute 'XXX'解決方法

錯誤舉例: 錯位原因定位: 檢視import庫的原始檔,發現原始檔存在且沒有錯誤,同時存在原始檔的.pyc檔案 解決方法: 1、命名py指令碼時,不要與python預留字,模組名等相同 例如:模組是ssl,請不要命名ssl.py檔案,因為程式碼執行時會對應生成.pyc檔案。

關於ids for this class must be manually assigned before calling save()

引起問題的原因: 就是那個由Hibernate根據資料庫表自動生成的"類名.hbm.xml"對映檔案引起的。 首先我的表(Info)由兩個欄位組成,即: int id;//主建 String name; (自己做測試,所以就簡單的建了個表) 由Hibernate生成的Info

開機提示:one of your disks needs to be checked解決方法

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

fatal error LNK1104: 無法開啟檔案“***.lib“ 解決方法

  相關: Visual Stuido (1): 跨專案呼叫 同一個solution下面不同project之間的方法呼叫   轉載:https://blog.csdn.net/zyjj_99/article/details/39394477   我們

eclipse error pages打紅X的解決方法

轉載:https://blog.csdn.net/bug_love/article/details/72636505 每次建一個Maven專案轉為web專案的時候,這裡總有這麼多檔案,而且還會有一個Error Pages的錯紅的紅叉,看著很不爽。雖然專案中沒有出現過錯誤,但是對於我來說,始終是個

ios 協議(delegate)使用過程中遇到assign attribute must be unsafeunretained

今天在使用協議的過程中,偶然發現這樣使用 @interface AppDelegate (){ id<ChatDelegate> testdelegate; } @property (nonatomic , assign) id<ChatDelegate>

MySQL is running but PID file could not be found(解決方法)

啟動MySQL時報錯: [[email protected] /]# service mysqld status MySQL is running but PID file could not be found    [失敗]   解決辦法: 找到並kill掉

putty提示Network error:Software caused connection abort解決方法

最近使用putty的時候老是提示 network error software caused connection abort 網路錯誤軟體造成連線中斷 下面給出解決putty連線中斷辦法: 1.在linux伺服器端設定: vi /etc/ssh/sshd_config 找

Linux MySQl 5.7.17 MySQL ERROR 1366(HY000):Incorrect string value 解決方法

MySQL ERROR 1366(HY000):Incorrect string value,在往資料庫中插入中文的時候會出現。這也就是編碼問題,網上大部分都是說設定下配置檔案中的設定,而可悲的是在我的環境中配置檔案是不允許修改,或者說和其他版本的不同。大家都知道中文常用的編碼方式是gbk或者utf-8。我建