Android开发中,在资源文件 values文件中报错,信息如下:
Error:(390) Apostrophe not preceded by \ (in What's the Date?)
出现此错误的原因是特殊字符没有被转义,在我的项目中是What's中的’没有被转义
<?xml version="1.0" encoding="utf-8"?>
<resources>
...
<string name=“whats_the_date”>What's the Date?</string>
</resources>
解决:将上述代码添加上转义字符\
<?xml version="1.0" encoding="utf-8"?>
<resources>
...
<string name=“whats_the_date”>What\'s the Date?</string>
</resources>
修改后,错误消失,可正常编译