我對android比較陌生,所以請耐心等待。在我的專案中,我需要兩個微調器物件,因此我的 strings.xml 資源檔案中需要兩個不同的字串陣列。當我嘗試將第二個字串陣列添加到 xml 并運行應用程式時,我收到資源編譯失敗錯誤。它指向失敗的 :app:mergeDebugResources 。除了這條訊息之外,我真的不知道還有什么問題,因為 Logcat 視窗中沒有任何內容。如果需要更多資訊,請告訴我。
<resources>
<string name="app_name">MindYourPet2</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="submit">submit</string>
<string name="pet_profiles_title">Pets</string>
<string name="add_pet_title">Add Pet</string>
<string name="reminders_title">Reminders</string>
<string-array name="species">
<item>-</item>
<item>Cat</item>
<item>Dog</item>
</string-array>
<string-array name="frequency">
<item>Don't Repeat</item>
<item>Every Day</item>
<item>Every Week</item>
<item>Every Month</item>
</string-array>
uj5u.com熱心網友回復:
我認為問題可能是 XML 中的語法錯誤,阻止 Android Studio/SDK 完成對 XML 資源的決議以生成諸如 R.java 之類的東西
我在您的 XML 中注意到的一個問題是撇號需要轉義。
<item>Don't Repeat</item>
應該
<item>Don\'t Repeat</item>
這樣,它不會將撇號視為引號并導致 XML 格式出現問題,而是將其視為任何其他字符。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/421918.html
標籤:
