Android build fails if app name contains an apostrophe

I have discovered a bug in EAS build’s Android build process. My guess is that when generating strings.xml, EAS is not escaping apostrophes (and possibly other control characters) leading to the following error:

[stderr] FAILURE: Build failed with an exception.

[stderr] * What went wrong:

[stderr] Execution failed for task ':app:mergeReleaseResources'.

[stderr] > A failure occurred while executing$ActionFacade

[stderr]    > Android resource compilation failed

[stderr]      /build/workingdir/build/mobile/android/app/src/main/res/values/strings.xml:3:3-46: AAPT: error: unescaped apostrophe in string


[stderr]      /build/workingdir/build/mobile/android/app/src/main/res/values/strings.xml:3:3-46: AAPT: error: not a valid string.


[stderr]      /build/workingdir/build/mobile/android/app/build/intermediates/incremental/mergeReleaseResources/merged.dir/values/values.xml: AAPT: error: file failed to compile.

On latest Expo and EAS clients.

To reproduce:

  • expo init
  • Edit app.json, change the name key to “Let’s Break Expo”
  • eas build -p android
  • Watch the Run gradlew step in Expo and be sad when it breaks

Workaround: Replace apostrophe with ’ (U+2019)

I can confirm that the unescaped apostrophe is added to strings.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  <string name="app_name">Nine o'clock</string>
  <string name="expo_splash_screen_resize_mode" translatable="false">contain</string>
  <string name="expo_splash_screen_status_bar_translucent" translatable="false">false</string>

This happens during expo prebuild, so I think it would be a good idea for you to create an issue here.