Android error: “Apostrophe not preceded by \” 解决办法

来源:互联网 发布:法语之言能无从乎 编辑:程序博客网 时间:2024/05/29 12:33

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>


修改后,错误消失,可正常编译

0 0
原创粉丝点击