Android error: AAPT: error: unescaped apostrophe in string

created at 09-02-2021 views: 54

cause of the error

When doing the internationalization multi-language function, I defined some strings in the arrays.xml file as follows

<item>My name's Lisa</item>

So I thought about the error that might be caused by', so I replaced the above code with the following code to report the error and solved it.

<item>My name&quot;s Lisa</item>

Error solution

  • The ' can be replaced with &quot;, such as: <item>My name&quot;s Lisa</item>
  • You can use double quotes “” to enclose string resources, such as: <item>"My name's Lisa"</item>
  • You can use escape characters before the apostrophe ', such as: <item>My name\'s Lisa</item>
created at:09-02-2021
edited at: 09-02-2021: