In my strings.xml, I have made a string containing (it's) and I get this error.
Error:(218) Apostrophe not preceded by \
Yes, I know I have to either place a \ before the apostrophe, or just delete the apostrophe, but my problem is that when I run the app using (it\s) or just deleting it, it comes back; even if I delete the whole string, it all comes back when I click run. How do I stop this?
Here's the String but it really doesn't matter. I just want it to be deleted and not restored when I run the app.
<string> name="talk" So, you want these things? LOL its gonna</string>
When the error occurs, Android Studio opens the values.xml which, at that point in the file, deceptively looks exactly the same as your strings.xml. Make sure you're updating the strings.xml and you should be good to go.
Actually, there are two files strings.xml and values.xml
We edit our string data in strings.xml and whenever we getting the error like Apostrophe not preceded by \, When you click on error android studio redirect you to values.xml and you are editing in values.xml and android studio just deleted what you edited.
So make sure you are editing strings.xml not values.xml
Place your string in double quotes.<string>"Your text 'here'"</string>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With