Gradle Build failed for Invalid Color? SDK 41

On SDK 41 I get a gradle build failed because of an “invalid Color”

Log (Full Gradle Log):

[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:mergeReleaseResources'.
[stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
[stderr]    > Android resource compilation failed
[stderr]      /app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/res/values/colors.xml:14:3-55: AAPT: error: invalid color.
[stderr]          
[stderr]      /app/turtle/workingdir/android/sdk41/android-shell-app/app/build/intermediates/incremental/mergeReleaseResources/merged.dir/values/values.xml: AAPT: error: file failed to compile.
[stderr]          
[stderr] * Try:
[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.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 42s

Here is my Expo Diagnostics:


  Expo CLI 4.5.2 environment info:
    System:
      OS: macOS Mojave 10.14.6
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 14.16.1 - ~/.nvm/versions/node/v14.16.1/bin/node
      Yarn: 1.22.10 - /usr/local/bin/yarn
      npm: 7.16.0 - ~/.nvm/versions/node/v14.16.1/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
      Android SDK:
        API Levels: 28, 29
        Build Tools: 28.0.3, 29.0.1, 29.0.2, 30.0.0, 30.0.0, 30.0.0, 30.0.2, 31.0.0
        System Images: android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
    IDEs:
      Android Studio: 4.2 AI-202.7660.26.42.7351085
      Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
    npmPackages:
      expo: ^41.0.0 => 41.0.1 
      react: 16.13.1 => 16.13.1 
      react-native: https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz => 0.63.2 
    Expo Workflow: managed

you probably have an invalid color defined for your splash screen

What colors are invalid? does the splash screen support .png?

Here is my splash screen from app.json


  "splash": {
      "image": "./assets/launchscreen.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },

looks correct to me. what other colors are you using in app.json? android status bar? navigation bar? they should be hex colors in the exact format that you provided above

   "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/launchscreen2.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },

...
 "notification": {
      "icon": "./assets/logo96x96.png",
      "color": "#00000",
      "androidMode": "default",
      "androidCollapsedTitle": "MyRewards",
      "iosDisplayInForeground": true
    },

...

 "androidStatusBarColor": "#00c497",
    "androidStatusBar": {
      "barStyle": "light-content",
      "backgroundColor": "#01cca1"
    },

I also swapped the launchscreen.png for one with a plain color. Could it be the format?

cjs-MBP13-2017:assets cj$ file launchscreen.png 
launchscreen.png: PNG image data, 1242 x 2208, 8-bit/color RGBA, non-interlaced

there are 5 zeros there, should be 6.

1 Like

That fixed it! Thank you!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.