【问题标题】:Android Studio gradle keeps on repeating already fixed error when buildingAndroid Studio gradle 在构建时不断重复已经修复的错误
【发布时间】:2016-11-10 07:00:32
【问题描述】:

我现在真的很沮丧。我在 values.xml 文件中创建了这样的字符串资源

    <string name="details">the yadayadayada is going to be a great suspension and when it comes, it's good. after a long time</string>

在运行我的应用程序后,我遇到了这个错误

Error:(348) Apostrophe not preceded by \ (in the yadada is going to be a great suspension and when it comes, it's good. after a long time)

所以我在撇号前面加上 '\' 但错误仍然显示。现在我实际上已经删除了字符串资源,但是当 gradle 构建时,它会再次重新创建资源,然后再次给我同样的错误。我试过“无效缓存/重启”,我试过删除我的 .gradle 文件夹,我什至使用了命令

gradlew --stop clean build

但错误仍在显示。我真的不知道现在该怎么办。 提前感谢您的帮助

【问题讨论】:

    标签: android android-studio gradle android-gradle-plugin build.gradle


    【解决方案1】:

    我认为您正在修改生成的文件(具有相同的名称)而不是您自己的 res 文件。当您单击错误时,它会打开生成的文件而不是正确的文件。所以转到您的 res 文件夹并进行更改。

    【讨论】:

    • 天哪..我太愚蠢了。我实际上是在编辑生成的资源文件“values.xml”,而真正的字符串在 strings.xml 文件中。非常感谢:D
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-21
    • 2016-06-03
    • 1970-01-01
    相关资源
    最近更新 更多