2013-05-07 81 views
0

resource array-string我已經把:的Android資源字符串數組「無效字符」

<string-array name="Gefühle_de"> 
<item>xxx</item> 
</string-array> 

但我收到的錯誤爲無效字符Gefühle(這是一個德語語言)。 如何解決問題?

+0

這是在arrays.xml下的/ res/values? – Raghunandan 2013-05-07 12:40:09

+0

@Raghunandan這可以在/ res/values下的strings.xml中進行。不需要arrays.xml。 – TronicZomB 2013-05-07 12:44:30

+1

@TronicZomB我知道我只是澄清因爲上述爲我工作。我沒有看到問題 – Raghunandan 2013-05-07 12:50:30

回答

3

我認爲問題是大寫的G,爲字符串數組名稱。

必須是:

<string-array name="gefühle_de"> 
<item>xxx</item> 
</string-array> 

編輯:你真正需要的「U」字符的名稱,「U」是不夠的?

最佳做法是避免使用大寫字母和重音字符作爲標記名稱。

+0

我與什麼@ Shemsu-賀說,remeber總是使用標準的命名規則非常同意,英文是用繩子gefühle_de足夠 – 3h3 2013-05-07 12:40:54

+0

好吧,我收到了同樣的錯誤,ü是必要的,因爲是一個德語單詞,我不知道如果沒有它 – shuttle1978 2013-05-07 12:41:30

0

我會假設基地Androind不能識別name屬性中「u」的變音。嘗試設置爲name="gefuhle_de"

編輯:當我把原來的值與元音到我的strings.xml,這是我的R.java來如:

public final class R { 
public static final class array { 
    public static final int Gefühle_de=0x7f070001; 
    public static final int spin=0x7f070000; 
} 

它是生產上的分數字符錯誤(左起第五個)。這似乎表明變音符號正在導致問題。嘗試刪除變音符,小寫「G」(在我的情況下不需要),然後清理您的項目。

+0

好吧謝謝我會這樣做 – shuttle1978 2013-05-07 12:46:42

+0

結果如何? – TronicZomB 2013-05-07 12:50:25

+0

@ shuttle1978你是否試圖清理你的項目也許......? – TronicZomB 2013-05-07 12:52:33