撇号之前没有\\

时间:2017-01-10 18:23:56

标签: android android-resources

我有一个像这样的字符串资源值:

<string name="you_sure">Are you sure you want to do this?\n(It can't be recovered.)</string>

构建我的android项目时,我不断收到错误:

Error:(377) Apostrophe not preceded by \ (in Are you sure you want to do this?\n(It can't be recovered.))

为什么?

2 个答案:

答案 0 :(得分:1)

因为您有撇号(&{34}中的'可以&#39;#34;),并且需要将其转义为\'。引号(\")也是如此。

答案 1 :(得分:0)

请阅读manual

两个

  

这个<\ n>工作

  

&#34;这将工作&#34;

是正确的

您无需逃避&#39; \ n&#39;