1

I wanted to localize my app to Frenc and other languages, thus I creates the above mentioned folder and stuffed all my strings after translating them to French. I am getting compile time error "Apostroph not preceded by \". According to the error and this SO question I added \ in front of all the apostrophes but when I compile it Android Studio removes all the backslashes and throws me the same exception. Has anyone run into this problem? What is the easiest solution? This is the error I am getting,

Error:(74) Apostrophe not preceded by \ (in "En téléchargeant une application d'mybiz ou Google ™ (ci-après appelée «La Société»), l'installation ou l'utilisation de cette application ou de toute partie de celle-ci ( «Application»), vous acceptez les termes et conditions Et Conditions ").

which is arising from the first line of my terms and conditions long string.

<string name="terms">
 "En téléchargeant une application d'mybiz ou Google ™ (ci-après appelée «La Société»), l'installation ou l'utilisation de cette application ou de toute partie de celle-ci ( «Application»), vous acceptez les termes et conditions Et Conditions ").
more text and then"
</string>

I have added the quote at the end but AS adds it for me and removes all my changes when it compiles. I have also replaced the parenthesis with <<>> but again it removes my changes. Even when I remove the whole terms strings it adds all the string for me when it compiles. This has been the most annoying and stressful thanksgiving weekend for me thanks to Android Studio and Google. I hope someone saves me.

Community
  • 1
  • 1
The_Martian
  • 3,684
  • 5
  • 33
  • 61

2 Answers2

1

There's a filed bug report here:

https://code.google.com/p/android/issues/detail?id=221901

What I did to solve the issue is I edited the file

app\src\main\res\values\strings.xml

via an external editor and ALSO its counterpart:

app\build\intermediates\res\merged\dev\debug\values\values.xml
Gonzalo
  • 3,674
  • 2
  • 26
  • 28
0

I escaped all the apostrophes in French folder using \ and removed the outer quotes of those strings as shown below.

<string name="name">"McDonald's"</string>

to

<string name="name">McDonald\'s</string>

I hope this helps someone in similar situation.

The_Martian
  • 3,684
  • 5
  • 33
  • 61