Android - strings.xml 无法转义单引号

标签 android android-xml

这是我得到的错误:

Execution failed for task ':MyPackage:processReleaseResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/abc/android-sdk-macosx/build-tools/22.0.1/aapt'' finished with non-zero exit value 1
 No resource found that matches the given name (at 'text' with value '@string/secondary_text').

我的@string/secondary_text是这样的:

<string name="secondary_text">They&#39;re all free to download.</string>

我在这里转义单引号,我尝试过 &apos;也是,还是没用。唯一有效的是我改变了They'reThey are .

有人知道如何在 Android 上转义单引号吗?

最佳答案

您可以仅使用 \' 作为单引号。

关于Android - strings.xml 无法转义单引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41727312/

相关文章:

android - android logcat 中的 GasService

android - 在 Intent fragment 上获取可序列化的 ArrayList

android - 制作 Node.js 服务器的独立解决方案

java - 无法启动 Activity ComponentInfo : android. view.InflateException: Binary XML file line #63: Error inflating class <unknown>

java - 为什么将设备语言更改为 RTL 语言时 fragment/Activity 布局看起来很糟糕?

android - fragment 膨胀 xml 中的数字格式异常

android - 当我更改 xml 元素的位置时强制关闭

java - Eclipse - 现有代码中的 Android 项目不起作用

android - 如何使用 Paging Library 正确实现 kotlin 协程?

android - 抽屉导航标题是否超过了内容?