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>修改后,错误消失,可正常编译
本文介绍了解决Android开发中因特殊字符未转义导致的资源文件报错问题。通过在特殊字符前添加转义字符,成功解决了错误并实现了正常编译。
4115

被折叠的 条评论
为什么被折叠?



