更新我的android studio后,显示错误,例如Android资源编译失败。请帮助我

时间:2018-10-05 06:22:21

标签: android android-studio

Android resource compilation failed
Output:  C:\Users\DevoDev1\AndroidStudioProjects\Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1339: error: unescaped apostrophe in string
"Who should feed "First Feed" or Anna Prasana to the baby? \n\n (a) Father \n (b) Mother \n (c) Uncle (Mother's Brother) \n (d) Grand Father (Month's father) \n\n Who else can feed first?".
C:\Users\DevoDev1\AndroidStudioProjects\Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1339: error: not a valid string.
C:\Users\DevoDev1\AndroidStudioProjects\Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1343: error: unescaped apostrophe in string
"Lamp should be facing our side or God\'s side \n\n (a) To God side, because we are offering to God \n (b) Our side, because we need the God's grace on us \n (c) Doesn't matter \n\n What is your take?".
C:\Users\DevoDev1\AndroidStudioProjects\Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1343: error: not a valid string.
C:\Users\DevoDev1\AndroidStudioProjects\Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1455: error: unescaped apostrophe in string
"Don't loosen your belt".
C:\Users\DevoDev1\AndroidStudioProjects\Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1455: error: not a valid string.

Command: C:\Users\DevoDev1.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\85067246fdfeb2b4bb965a42850c6b89\aapt2-3.2.0-4818971-windows\aapt2.exe compile --legacy \ -o \ C:\Users\DevoDev1\AndroidStudioProjects\Test\app\build\intermediates\res\merged\debug \ C:\Users\DevoDev1\AndroidStudioProjects\Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #0

enter image description here

4 个答案:

答案 0 :(得分:4)

错误在您的字符串文件中。替换此字符串

Who should feed "First Feed" or Anna Prasana to the baby? \n\n (a) Father \n (b) Mother \n (c) Uncle (Mother's Brother) \n (d) Grand Father (Month's father) \n\n Who else can feed first?

Lamp should be facing our side or God\'s side \n\n (a) To God side, because we are offering to God \n (b) Our side, because we need the God's grace on us \n (c) Doesn't matter \n\n What is your take?

Don't loosen your belt

使用:

Who should feed \"First Feed\" or Anna Prasana to the baby? \n\n (a) Father \n (b) Mother \n (c) Uncle (Mother\'s Brother) \n (d) Grand Father (Month\'s father) \n\n Who else can feed first?

Lamp should be facing our side or God\'s side \n\n (a) To God side, because we are offering to God \n (b) Our side, because we need the God\'s grace on us \n (c) Doesn\'t matter \n\n What is your take?

Don\'t loosen your belt

您错过了单引号和双引号

答案 1 :(得分:2)

我有同样的问题。尝试通过android studio中的Project打开values.xml

C:\Users\DevoDev1\AndroidStudioProjects\Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml

查找行:1339、1343、1455并进行编辑。

答案 2 :(得分:1)

更新到3.3.2后遇到相同的问题。我忽略了当前项目并重新克隆,或创建了一个新项目为我解决了该问题。编码愉快。

答案 3 :(得分:0)

在我的情况下,我在字符串中有多个用错误标记的撇号。不幸的是,如果字符串中有多个撇号,则Android Studio IDE不会在所有单词上都用撇号加下划线,因此很容易错过撇号。仔细查看错误报告,并仔细检查标记的字符串。您可能会发现您对字符串中的某些撇号进行了转义,但并非全部