我收到此錯誤訊息:
> Task :app:mergeDebugResources
C:\Users\user\Desktop\Kotlin Projects\Projects\10000Months\app\src\main\res\values\strings.xml:51:4: Failed to flatten XML for resource 'Turn_Your_Ideas_into_Product' with error: Attempting to flatten xml with unfinished spans.
C:\Users\user\Desktop\Kotlin Projects\Projects\10000Months\app\src\main\res\values\strings.xml:51:4: string/Turn_Your_Ideas_into_Product does not contain a valid string resource.
C:\Users\user\Desktop\Kotlin Projects\Projects\10000Months\app\src\main\res\values\strings.xml:65:4: Failed to flatten XML for resource 'Write_a_Short_Book' with error: Attempting to flatten xml with unfinished spans.
C:\Users\user\Desktop\Kotlin Projects\Projects\10000Months\app\src\main\res\values\strings.xml:65:4: string/Write_a_Short_Book does not contain a valid string resource.
每當我在 Android Studio 的 values->strings 中使用這些字串(如下)時。請看看他們我應該添加或洗掉什么;
<!--Record Your Conversations-->
<string name="Record_Your_Conversations">
<font size="17">Record Your Conversations</font>\n
<font size="13">Is there a subject that you\'re exceptional knowledgeable about? Or even a subject that you\'re really interested in diving into a little deeper? Are you a good listener?…</font>
</string>
<!--Write a Short Book-->
<string name="Write_a_Short_Book">
<font size="17">Write a Short Book</font>\n
<font size="13">Writing a book is not easy, but we\'ll assist you, and this is especially good avenue to take if you're not interested in audio, video, or physical products…</font>
</string>
編輯:
我還有其他類似的字串,比如這個:
<!--Teach People What You Know-->
<string name="Teach_People_What_You_Know">
<font size="17">Teach People What You Know</font>\n
<font size="13">I bet you know things. Things that other people don\'t know. Music, sales, yoga etc. These are things people are constantly learning…</font>
</string>
它對他們有用,我不知道其他 2 個字串有什么問題..
謝謝你的幫助..
uj5u.com熱心網友回復:
這是你的問題,你有一個未轉義的參考Write_a_Short_Book:
如果你不感興趣,就拿
您沒有發布Turn_Your_Ideas_into_Product(錯誤日志中的另一個),但這可能是相同的問題
uj5u.com熱心網友回復:
你不能在strings.xml 中使用這樣的html。您應該使用 CDATA[] 如下所示:
<string name="string_html"><![CDATA[<b>Html text</b>]]></string>
或者像下面的例子一樣:
<string name="string_html"><b>Html text<br><font color=\"#fe2e68\">text example</font></b></string>
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/385831.html
上一篇:使用XML填充表格
下一篇:如何使用sql提取xml子節點
