Android build suddenly failed (Gradle issue)

Hi,
I have changed an image in my application and run expo build:android --release-channel production.
The application is working and already in Play Store and received an update because of the build process.
BUT somehow, I’m getting an error in Gradle phase in the build.

Heres the gradle phase output:

Configuration on demand is an incubating feature.
Thu, 04 Feb 2021 19:32:48 GMT
> Configure project :app
Thu, 04 Feb 2021 19:32:48 GMT
WARNING: The option setting 'android.useNewApkCreator=false' is experimental.
Thu, 04 Feb 2021 19:32:48 GMT
The current default is 'true'.
Thu, 04 Feb 2021 19:32:50 GMT
AWS Device Farm Plugin version 1.3
Thu, 04 Feb 2021 19:33:00 GMT
Installing unimodules:
Thu, 04 Feb 2021 19:33:00 GMT
 unimodules-core@6.0.0 from /app/turtle/workingdir/android/sdk40/packages/@unimodules/core
Thu, 04 Feb 2021 19:33:00 GMT
 unimodules-react-native-adapter@5.7.0 from /app/turtle/workingdir/android/sdk40/packages/@unimodules/react-native-adapter
Thu, 04 Feb 2021 19:33:00 GMT
 expo-ads-admob@8.4.0 from /app/turtle/workingdir/android/sdk40/packages/expo-ads-admob
Thu, 04 Feb 2021 19:33:00 GMT
 expo-ads-facebook@8.4.1 from /app/turtle/workingdir/android/sdk40/packages/expo-ads-facebook
Thu, 04 Feb 2021 19:33:00 GMT
 expo-analytics-amplitude@9.0.0 from /app/turtle/workingdir/android/sdk40/packages/expo-analytics-amplitude
Thu, 04 Feb 2021 19:33:00 GMT
 expo-analytics-segment@9.1.0 from /app/turtle/workingdir/android/sdk40/packages/expo-analytics-segment
Thu, 04 Feb 2021 19:33:00 GMT
 expo-app-auth@9.3.0 from /app/turtle/workingdir/android/sdk40/packages/expo-app-auth
Thu, 04 Feb 2021 19:33:00 GMT
 expo-application@2.4.1 from /app/turtle/workingdir/android/sdk40/packages/expo-application
Thu, 04 Feb 2021 19:33:00 GMT
 expo-av@8.7.0 from /app/turtle/workingdir/android/sdk40/packages/expo-av
Thu, 04 Feb 2021 19:33:00 GMT
 expo-background-fetch@8.6.0 from /app/turtle/workingdir/android/sdk40/packages/expo-background-fetch
Thu, 04 Feb 2021 19:33:00 GMT
 expo-barcode-scanner@9.1.0 from /app/turtle/workingdir/android/sdk40/packages/expo-barcode-scanner
Thu, 04 Feb 2021 19:33:00 GMT
 expo-battery@3.1.0 from /app/turtle/workingdir/android/sdk40/packages/expo-battery
Thu, 04 Feb 2021 19:33:00 GMT
 expo-brightness@8.4.0 from /app/turtle/workingdir/android/sdk40/packages/expo-brightness
Thu, 04 Feb 2021 19:33:00 GMT
 expo-calendar@8.6.0 from /app/turtle/workingdir/android/sdk40/packages/expo-calendar
Thu, 04 Feb 2021 19:33:00 GMT
 expo-camera@9.1.0 from /app/turtle/workingdir/android/sdk40/packages/expo-camera
Thu, 04 Feb 2021 19:33:00 GMT
 expo-cellular@2.4.0 from /app/turtle/workingdir/android/sdk40/packages/expo-cellular
Thu, 04 Feb 2021 19:33:00 GMT
 expo-constants@9.3.3 from /app/turtle/workingdir/android/sdk40/packages/expo-constants
Thu, 04 Feb 2021 19:33:00 GMT
 expo-contacts@8.6.0 from /app/turtle/workingdir/android/sdk40/packages/expo-contacts
Thu, 04 Feb 2021 19:33:00 GMT
 expo-crypto@8.4.0 from /app/turtle/workingdir/android/sdk40/packages/expo-crypto
Thu, 04 Feb 2021 19:33:00 GMT
 expo-device@2.4.0 from /app/turtle/workingdir/android/sdk40/packages/expo-device
Thu, 04 Feb 2021 19:33:00 GMT
 expo-document-picker@8.4.1 from /app/turtle/workingdir/android/sdk40/packages/expo-document-picker
Thu, 04 Feb 2021 19:33:00 GMT
 expo-error-recovery@1.4.0 from /app/turtle/workingdir/android/sdk40/packages/expo-error-recovery
Thu, 04 Feb 2021 19:33:00 GMT
 expo-face-detector@8.4.0 from /app/turtle/workingdir/android/sdk40/packages/expo-face-detector
Thu, 04 Feb 2021 19:33:00 GMT
 expo-facebook@9.1.0 from /app/turtle/workingdir/android/sdk40/packages/expo-facebook
Thu, 04 Feb 2021 19:33:00 GMT
 expo-file-system@9.3.0 from /app/turtle/workingdir/android/sdk40/packages/expo-file-system
Thu, 04 Feb 2021 19:33:00 GMT
 expo-firebase-analytics@2.6.0 from /app/turtle/workingdir/android/sdk40/packages/expo-firebase-analytics
Thu, 04 Feb 2021 19:33:00 GMT
 expo-firebase-core@1.3.0 from /app/turtle/workingdir/android/sdk40/packages/expo-firebase-core
Thu, 04 Feb 2021 19:33:00 GMT
 expo-font@8.4.0 from /app/turtle/workingdir/android/sdk40/packages/expo-font
Thu, 04 Feb 2021 19:33:00 GMT
 expo-gl-cpp@9.2.0 from /app/turtle/workingdir/android/sdk40/packages/expo-gl-cpp
Thu, 04 Feb 2021 19:33:00 GMT
 expo-gl@9.2.0 from /app/turtle/workingdir/android/sdk40/packages/expo-gl
Thu, 04 Feb 2021 19:33:00 GMT
 expo-google-sign-in@8.4.0 from /app/turtle/workingdir/android/sdk40/packages/expo-google-sign-in
Thu, 04 Feb 2021 19:33:00 GMT
 expo-haptics@8.4.0 from /app/turtle/workingdir/android/sdk40/packages/expo-haptics
Thu, 04 Feb 2021 19:33:00 GMT
 expo-image-loader@1.3.0 from /app/turtle/workingdir/android/sdk40/packages/expo-image-loader
Thu, 04 Feb 2021 19:33:00 GMT
 expo-image-manipulator@8.4.0 from /app/turtle/workingdir/android/sdk40/packages/expo-image-manipulator
Thu, 04 Feb 2021 19:33:00 GMT
 expo-image-picker@9.2.0 from /app/turtle/workingdir/android/sdk40/packages/expo-image-picker
Thu, 04 Feb 2021 19:33:00 GMT
 expo-intent-launcher@8.4.0 from /app/turtle/workingdir/android/sdk40/packages/expo-intent-launcher
Thu, 04 Feb 2021 19:33:00 GMT
 expo-keep-awake@8.4.0 from /app/turtle/workingdir/android/sdk40/packages/expo-keep-awake
Thu, 04 Feb 2021 19:33:00 GMT
 expo-linear-gradient@8.4.0 from /app/turtle/workingdir/android/sdk40/packages/expo-linear-gradient
Thu, 04 Feb 2021 19:33:00 GMT
 expo-local-authentication@9.5.0 from /app/turtle/workingdir/android/sdk40/packages/expo-local-authentication
Thu, 04 Feb 2021 19:33:00 GMT
 expo-localization@9.1.0 from /app/turtle/workingdir/android/sdk40/packages/expo-localization
Thu, 04 Feb 2021 19:33:00 GMT
 expo-location@10.0.0 from /app/turtle/workingdir/android/sdk40/packages/expo-location
Thu, 04 Feb 2021 19:33:00 GMT
 expo-mail-composer@9.0.0 from /app/turtle/workingdir/android/sdk40/packages/expo-mail-composer
Thu, 04 Feb 2021 19:33:00 GMT
 expo-media-library@10.0.0 from /app/turtle/workingdir/android/sdk40/packages/expo-media-library
Thu, 04 Feb 2021 19:33:00 GMT
 expo-network@2.4.0 from /app/turtle/workingdir/android/sdk40/packages/expo-network
Thu, 04 Feb 2021 19:33:00 GMT
 expo-notifications@0.8.2 from /app/turtle/workingdir/android/sdk40/packages/expo-notifications
Thu, 04 Feb 2021 19:33:00 GMT
 expo-permissions@10.0.0 from /app/turtle/workingdir/android/sdk40/packages/expo-permissions
Thu, 04 Feb 2021 19:33:00 GMT
 expo-print@9.2.0 from /app/turtle/workingdir/android/sdk40/packages/expo-print
Thu, 04 Feb 2021 19:33:00 GMT
 expo-screen-capture@2.0.0 from /app/turtle/workingdir/android/sdk40/packages/expo-screen-capture
Thu, 04 Feb 2021 19:33:00 GMT
 expo-screen-orientation@2.1.0 from /app/turtle/workingdir/android/sdk40/packages/expo-screen-orientation
Thu, 04 Feb 2021 19:33:00 GMT
 expo-secure-store@9.3.0 from /app/turtle/workingdir/android/sdk40/packages/expo-secure-store
Thu, 04 Feb 2021 19:33:00 GMT
 expo-sensors@9.2.0 from /app/turtle/workingdir/android/sdk40/packages/expo-sensors
Thu, 04 Feb 2021 19:33:00 GMT
 expo-sharing@8.5.0 from /app/turtle/workingdir/android/sdk40/packages/expo-sharing
Thu, 04 Feb 2021 19:33:00 GMT
 expo-sms@8.4.0 from /app/turtle/workingdir/android/sdk40/packages/expo-sms
Thu, 04 Feb 2021 19:33:00 GMT
 expo-speech@8.5.0 from /app/turtle/workingdir/android/sdk40/packages/expo-speech
Thu, 04 Feb 2021 19:33:00 GMT
 expo-splash-screen@0.8.1 from /app/turtle/workingdir/android/sdk40/packages/expo-splash-screen
Thu, 04 Feb 2021 19:33:00 GMT
 expo-sqlite@8.5.0 from /app/turtle/workingdir/android/sdk40/packages/expo-sqlite
Thu, 04 Feb 2021 19:33:00 GMT
 expo-store-review@2.3.0 from /app/turtle/workingdir/android/sdk40/packages/expo-store-review
Thu, 04 Feb 2021 19:33:00 GMT
 expo-task-manager@8.6.0 from /app/turtle/workingdir/android/sdk40/packages/expo-task-manager
Thu, 04 Feb 2021 19:33:00 GMT
 expo-updates@0.4.1 from /app/turtle/workingdir/android/sdk40/packages/expo-updates
Thu, 04 Feb 2021 19:33:00 GMT
 expo-video-thumbnails@4.4.0 from /app/turtle/workingdir/android/sdk40/packages/expo-video-thumbnails
Thu, 04 Feb 2021 19:33:00 GMT
 expo-web-browser@8.6.0 from /app/turtle/workingdir/android/sdk40/packages/expo-web-browser
Thu, 04 Feb 2021 19:33:00 GMT
 unimodules-app-loader@1.4.0 from /app/turtle/workingdir/android/sdk40/packages/unimodules-app-loader
Thu, 04 Feb 2021 19:33:00 GMT
 unimodules-barcode-scanner-interface@5.4.0 from /app/turtle/workingdir/android/sdk40/packages/unimodules-barcode-scanner-interface
Thu, 04 Feb 2021 19:33:00 GMT
 unimodules-camera-interface@5.4.0 from /app/turtle/workingdir/android/sdk40/packages/unimodules-camera-interface
Thu, 04 Feb 2021 19:33:00 GMT
 unimodules-constants-interface@5.4.0 from /app/turtle/workingdir/android/sdk40/packages/unimodules-constants-interface
Thu, 04 Feb 2021 19:33:00 GMT
 unimodules-face-detector-interface@5.4.0 from /app/turtle/workingdir/android/sdk40/packages/unimodules-face-detector-interface
Thu, 04 Feb 2021 19:33:00 GMT
 unimodules-file-system-interface@5.4.0 from /app/turtle/workingdir/android/sdk40/packages/unimodules-file-system-interface
Thu, 04 Feb 2021 19:33:00 GMT
 unimodules-font-interface@5.4.0 from /app/turtle/workingdir/android/sdk40/packages/unimodules-font-interface
Thu, 04 Feb 2021 19:33:00 GMT
 unimodules-image-loader-interface@5.4.0 from /app/turtle/workingdir/android/sdk40/packages/unimodules-image-loader-interface
Thu, 04 Feb 2021 19:33:00 GMT
 unimodules-permissions-interface@5.4.0 from /app/turtle/workingdir/android/sdk40/packages/unimodules-permissions-interface
Thu, 04 Feb 2021 19:33:00 GMT
 unimodules-sensors-interface@5.4.0 from /app/turtle/workingdir/android/sdk40/packages/unimodules-sensors-interface
Thu, 04 Feb 2021 19:33:00 GMT
 unimodules-task-manager-interface@5.4.0 from /app/turtle/workingdir/android/sdk40/packages/unimodules-task-manager-interface
Thu, 04 Feb 2021 19:33:02 GMT
Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]
Thu, 04 Feb 2021 19:33:02 GMT
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Thu, 04 Feb 2021 19:33:03 GMT
Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]
Thu, 04 Feb 2021 19:33:03 GMT
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Thu, 04 Feb 2021 19:33:16 GMT
> Task :app:preBuild UP-TO-DATE
Thu, 04 Feb 2021 19:33:16 GMT
> Task :app:extractProguardFiles
Thu, 04 Feb 2021 19:33:16 GMT
> Task :app:preReleaseBuild
Thu, 04 Feb 2021 19:33:16 GMT
> Task :app:compileReleaseAidl NO-SOURCE
Thu, 04 Feb 2021 19:33:16 GMT
> Task :app:compileReleaseRenderscript NO-SOURCE
Thu, 04 Feb 2021 19:33:16 GMT
> Task :app:generateReleaseBuildConfig
Thu, 04 Feb 2021 19:33:16 GMT
> Task :app:generateReleaseResValues
Thu, 04 Feb 2021 19:33:16 GMT
> Task :app:generateReleaseResources
Thu, 04 Feb 2021 19:33:17 GMT
> Task :app:processReleaseGoogleServices
Thu, 04 Feb 2021 19:33:17 GMT
Parsing json file: /app/turtle/workingdir/android/sdk40/android-shell-app/app/google-services.json
Thu, 04 Feb 2021 19:33:17 GMT
> Task :app:javaPreCompileRelease
Thu, 04 Feb 2021 19:33:24 GMT
> Task :app:createReleaseCompatibleScreenManifests
Thu, 04 Feb 2021 19:33:24 GMT
> Task :app:extractDeepLinksRelease
Thu, 04 Feb 2021 19:33:27 GMT
> Task :app:processReleaseManifest
Thu, 04 Feb 2021 19:33:27 GMT
/app/turtle/workingdir/android/sdk40/android-shell-app/app/src/main/AndroidManifest.xml:17:9-26:20 Warning:
Thu, 04 Feb 2021 19:33:27 GMT
	provider#expo.modules.filesystem.FileSystemFileProvider@android:authorities was tagged at AndroidManifest.xml:17 to replace other declarations but no other declaration present
Thu, 04 Feb 2021 19:33:28 GMT
> Task :app:prepareLintJar
Thu, 04 Feb 2021 19:33:28 GMT
> Task :app:mergeReleaseShaders
Thu, 04 Feb 2021 19:33:28 GMT
> Task :app:compileReleaseShaders NO-SOURCE
Thu, 04 Feb 2021 19:33:28 GMT
> Task :app:generateReleaseAssets UP-TO-DATE
Thu, 04 Feb 2021 19:33:29 GMT
> Task :app:mergeReleaseAssets
Thu, 04 Feb 2021 19:33:31 GMT
> Task :app:checkReleaseDuplicateClasses
Thu, 04 Feb 2021 19:33:31 GMT
> Task :app:processReleaseJavaRes NO-SOURCE
Thu, 04 Feb 2021 19:33:36 GMT
> Task :app:collectReleaseDependencies
Thu, 04 Feb 2021 19:33:37 GMT
> Task :app:sdkReleaseDependencyData
Thu, 04 Feb 2021 19:33:37 GMT
> Task :app:mergeReleaseJniLibFolders
Thu, 04 Feb 2021 19:33:38 GMT
> Task :app:validateSigningRelease
Thu, 04 Feb 2021 19:33:38 GMT
> Task :app:mergeReleaseResources
Thu, 04 Feb 2021 19:33:45 GMT
> Task :app:processReleaseResources FAILED
Thu, 04 Feb 2021 19:33:45 GMT
> Task :app:mergeReleaseJavaResource
Thu, 04 Feb 2021 19:33:46 GMT
> Task :app:mergeReleaseNativeLibs
Thu, 04 Feb 2021 19:33:46 GMT
[stderr] FAILURE: Build failed with an exception.
Thu, 04 Feb 2021 19:33:46 GMT
[stderr] * What went wrong:
Thu, 04 Feb 2021 19:33:46 GMT
[stderr] Execution failed for task ':app:processReleaseResources'.
Thu, 04 Feb 2021 19:33:46 GMT
[stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Thu, 04 Feb 2021 19:33:46 GMT
[stderr]    > Android resource linking failed
Thu, 04 Feb 2021 19:33:46 GMT
[stderr]      /app/turtle/workingdir/android/sdk40/android-shell-app/app/src/main/res/values/strings.xml:2:3-45: AAPT: error: resource attr/MY_APP_NAME (aka com.***.***:attr/MY_APP_NAME) not found.
Thu, 04 Feb 2021 19:33:46 GMT
[stderr]          
Thu, 04 Feb 2021 19:33:46 GMT
[stderr] * Try:
Thu, 04 Feb 2021 19:33:46 GMT
[stderr] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Thu, 04 Feb 2021 19:33:46 GMT
[stderr] * Get more help at https://help.gradle.org
Thu, 04 Feb 2021 19:33:46 GMT
[stderr] BUILD FAILED in 1m 25s
Thu, 04 Feb 2021 19:33:46 GMT
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Thu, 04 Feb 2021 19:33:46 GMT
Use '--warning-mode all' to show the individual deprecation warnings.
Thu, 04 Feb 2021 19:33:46 GMT
See https://docs.gradle.org/6.6.1/userguide/command_line_interface.html#sec:command_line_warnings
Thu, 04 Feb 2021 19:33:46 GMT
20 actionable tasks: 20 executed
Thu, 04 Feb 2021 19:33:47 GMT
Error: ./gradlew exited with non-zero code: 1
    at ChildProcess.completionListener (/app/turtle/node_modules/@expo/xdl/node_modules/@expo/spawn-async/build/spawnAsync.js:52:23)
    at Object.onceWrapper (events.js:418:26)
    at ChildProcess.emit (events.js:311:20)
    at ChildProcess.EventEmitter.emit (domain.js:482:12)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
    ...
    at spawnAsync (/app/turtle/node_modules/@expo/xdl/node_modules/@expo/spawn-async/build/spawnAsync.js:17:21)
    at spawnAsyncThrowError (/app/turtle/node_modules/@expo/xdl/build/detach/ExponentTools.js:201:45)
    at buildShellAppAsync (/app/turtle/node_modules/@expo/xdl/build/detach/AndroidShellApp.js:976:11)
    at async Object.createAndroidShellAppAsync (/app/turtle/node_modules/@expo/xdl/build/detach/AndroidShellApp.js:396:5)
    at async runShellAppBuilder (/app/turtle/build/builders/android.js:95:9)
    at async Object.buildAndroid [as android] (/app/turtle/build/builders/android.js:43:28)
    at async build (/app/turtle/build/jobManager.js:181:33)
    at async processJob (/app/turtle/build/jobManager.js:118:32)
    at async Object.doJob (/app/turtle/build/jobManager.js:49:5)
    at async main (/app/turtle/build/server.js:66:13)

It says something about strings.xml file and attribute which is my app name. (I censored my app name and replaced it with MY_APP_NAME).

Maybe it is related to my app name because it in Hebrew? also my app name contains question mark.
Also, my app name is not showed fully, the question mark somehow trimmed from the error message - So I think it maybe related to the error.

expo diagnostic results:

  Expo CLI 4.1.6 environment info:
    System:
      OS: macOS 11.2
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.15.4 - /usr/local/bin/node
      npm: 6.14.10 - /usr/local/bin/npm
    SDKs:
      iOS SDK:
        Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    IDEs:
      Android Studio: 4.1 AI-201.8743.12.41.7042882
      Xcode: 12.4/12D4e - /usr/bin/xcodebuild
    npmPackages:
      expo: ^40.0.0 => 40.0.0 
      react: 16.13.1 => 16.13.1 
      react-dom: 16.13.1 => 16.13.1 
      react-native: https://github.com/expo/react-native/archive/sdk-40.0.0.tar.gz => 0.63.2 
      react-native-web: ~0.13.12 => 0.13.18 
    npmGlobalPackages:
      expo-cli: 4.1.6
    Expo Workflow: managed

Thanks for your help!

can you share a link to your build page to secure@expo.io? thanks

Thanks for the super quick reply! I have sent link to my build page.

hi @ahihenachta ! We’re taking the provided name and putting it in an XML file (strings.xml) when building your app. Turns out, ? need to be escaped with \?. Otherwise, the unescaped question mark means you’re trying to access another resource-

Thanks for the clarification.
I’ve tried build again with \? in my app name, but the error still occurs.
Maybe the escaping is not working correctly somehow?

Even after “double escaping” (\\?) it shows the same error message.
Maybe the build is using some cached previously build?

That’s weird, because when I passed the build with the “double escaping” app name, I saw in the build section that my app name is changed (with ‘\?’) so I can conclude that the app.json file was given correctly to the build.

UPDATE: Moreover, I completely remove ? from my app name, and the error still occurs :open_mouth:

FINAL UPDATE: It was my mistake, there was another field with my app name (facebookAppName) which contain the previous app name…

Now Everything is working, Thanks for your help and effort! You’ve build an amazing platform and community :slight_smile:

Btw, the actual solution was to remove the question mark from both fields and the build passed.
I’ve tried escaping the fields with no success (The error message showed again).