简体   繁体   中英

Android studio won't change string

In my strings.xml file I had this string:

<string name="lets_do_this">Let's Do This</string>

This gave me an error of:

Error:(897) Apostrophe not preceded by \\ (in Let's Do This)

So I changed the string to this:

<string name="lets_do_this">Let\'s Do This</string>

But every time I build the project, the string keeps changing back to the first version for some reason and I keep getting that error without the ability to change the string. Why is this happening?

如果它改回来,听起来就像你改变了build文件夹中的字符串xml文件,但是你需要在app模块的res/values中编辑你自己的文件。

If you have an apostrophe (') in your string, you must either escape it with a backslash (\\') or enclose the string in double-quotes ("").

see Formatting and Styling - String Resources

<string name="lets_do_this">"Let's Do This"</string>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM