Skip to main content
shipi18n logo|Documentation

android-unescaped-apostrophe: unescaped apostrophe in an Android strings.xml

error — fails the build

An apostrophe in an Android string resource that is neither backslash-escaped nor inside a fully double-quoted string. AAPT rejects it at build time ("Apostrophe not preceded by \") — the classic values-fr/strings.xml build breaker translators hit with French and Italian copy.

What triggers it

<!-- values-fr/strings.xml -->
<string name="greeting">C'est parti</string>

Fixed

<!-- escape it… -->
<string name="greeting">C\'est parti</string>
<!-- …or wrap the whole value in double quotes -->
<string name="greeting">"C'est parti"</string>

Why it matters

It is a hard compile error, not a cosmetic one: the Android build fails. The decoded value cannot reveal it, so the check inspects the raw resource text the way AAPT does.

How to fix it

Escape the apostrophe as \' or wrap the entire string value in double quotes.

How to silence it

--ignore-keys for the specific string, but this is almost always a real build break.

Check for this in CI

npx @shipi18n/cli check ./locales -s en
# SARIF for inline PR annotations:
npx @shipi18n/cli check ./locales -s en -r sarif -o shipi18n.sarif

The structural checks need no API key. Findings of this rule link back to this page from the SARIF helpUri.

Related rules