3

I get this error message:

> 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.

whenever I use these strings (below) in values->strings in Android Studio. Please take a look at them what should I add or remove;

<!--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>

Edit:

I have other similar strings, like this one:


<!--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>

It works for them, I don't know what is wrong with the other 2 strings..

Thanks for your help..

1

2 Answers 2

2

There's your problem, you've got an unescaped quote in Write_a_Short_Book:

take if you're not interested

You didn't post Turn_Your_Ideas_into_Product (the other one in your error log) but it's probably the same issue

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot for your observation, I actually saw it and ignore it, since it didn't warn me, beacuse it usually warns, thanks again.
0

You cannot use html like that in the strings.xml. You should either use CDATA[] like below:

<string name="string_html"><![CDATA[<b>Html text</b>]]></string> 

or otherwise like below example:

<string name="string_html">&lt;b&gt;Html text&lt;br&gt;&lt;font color=\"#fe2e68\"&gt;text example&lt;/font&gt;&lt;/b&gt;</string>

3 Comments

I 've added a string similar to the other it works fine.. I thought maybe something is with the syntax of the other two strings, like maybe I used " instead of ', or something..
I don't think it is possible to include html code in the strings.xml without any of the above ways. Can you share the strings that worked?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.