遇到了这个错误,编译无法通过 error: Apostrophe not preceded by \ 

错误的代码是:

   <string name="security_protocol_dialog_content_1_msg">Restoring factory settings, the system will erase the phone's data without warning.</string>

正确的代码是:

   <string name="security_protocol_dialog_content_1_msg">Restoring factory settings, the system will erase the phone\'s data without warning.</string>

额外加了一个转义字符(\)

当字符串中包含单引号(')的时候,就需要转义字符进行转义。

XML中的特殊字符:

单引号   '      '
双引号   "     "
大于号   >    >
小于号   <    <
与          &   &

  

相关文章:

  • 2021-08-03
  • 2022-12-23
  • 2021-05-24
  • 2021-05-07
猜你喜欢
  • 2022-12-23
  • 2021-06-25
  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
  • 2021-12-08
  • 2022-12-23
相关资源
相似解决方案