Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failing when using app.json splash config without backgroundColor - AAPT: error: resource color/splashscreen_background #2442

Open
Buk1m opened this issue Jun 19, 2024 · 4 comments
Labels
needs review Issue is ready to be reviewed by a maintainer

Comments

@Buk1m
Copy link

Buk1m commented Jun 19, 2024

Summary

Android build using on local and remote EAS build if app.json splash:{ backgroundColor } is not specified.

I upgraded the app from expo 49 to expo 51 and the eas-cli to lastest version. Previously the app build worked without issues for android with only splash:{ image } being specified. After the upgrade the build fails and the solution was to add a color value for the splash:{ backgroundColor } attribute

fails:

{
  "expo": {
    "splash": {
      "image": "./app/assets/splashscreen_background.png"
     }
  }
}

succedes:

{
  "expo": {
    "splash": {
      "image": "./app/assets/splashscreen_background.png",
      "backgroundColor": "#ffffff"
     }
  }
}

Managed or bare?

Managed

Environment

| expo-env-info 1.2.0 environment info:
    System:
      OS: macOS 13.6.7
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 18.20.2 - ~/.asdf/installs/nodejs/18.20.2/bin/node
      Yarn: 3.2.1 - ~/.asdf/installs/nodejs/18.20.2/bin/yarn
      npm: 10.5.0 - ~/.asdf/plugins/nodejs/shims/npm
      Watchman: HEAD-067252e - /opt/homebrew/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    IDEs:
      Android Studio: 2022.2 AI-222.4459.24.2221.10121639
      Xcode: 14.2/14C18 - /usr/bin/xcodebuild
    npmPackages:
      expo: 51 => 51.0.14
      react: 18.2.0 => 18.2.0
      react-native: 0.74.2 => 0.74.2
    npmGlobalPackages:
      eas-cli: 10.0.2
    Expo Workflow: managed
✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check native tooling versions
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check for issues with metro config
✔ Check npm/ yarn versions
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check that packages match versions required by installed Expo SDK
✔ Check that native modules do not use incompatible support packages
✔ Check for legacy global CLI installed locally
✔ Check that native modules use compatible support package versions for installed Expo SDK

Didn't find any issues with the project

Error output

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
> Android resource linking failed
     ERROR: /home/expo/workingdir/build/android/app/src/main/res/drawable/splashscreen.xml:2: AAPT: error: resource color/splashscreen_background (aka com.app.redactred:color/splashscreen_background) not found.
         
* Try:
> 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.
> Get more help at https://help.gradle.org.
BUILD FAILED in 8m 15s

Reproducible demo or steps to reproduce from a blank project

I don't have time to create demo but I assume if you create project with the latest expo
add app.json/app.config.js splash with image without backgroundColor property and use eas to build the app for android.

Current behaviour is not consistent with the expo-doctor schema validation, and with types specified for ExpoConfig where the backgroundColor is optional.

@Buk1m Buk1m added the needs review Issue is ready to be reviewed by a maintainer label Jun 19, 2024
@dnizetic
Copy link

dnizetic commented Jul 10, 2024

+1. And the error from gradle is so cryptic, it's completely unclear that the BG color should be added in expo.

@mnafiudrr
Copy link

I also encountered this issue when building with EAS after upgrading from Expo 48 to 51. Previously, I hadn't set the splash configuration in my app.json. After the upgrade, I received same error during the build process.

Then I added the splash bgcolor, and the build worked without any issues

{
  "expo": {
    "splash": {
      "backgroundColor": "#ffffff"
    }
  }
}

I think bgcolor should be added in expo, even without setting a splash image.

@Buk1m
Copy link
Author

Buk1m commented Aug 19, 2024

https://docs.expo.dev/tutorial/configuration/#configure-the-splash-screen-background-color

I do understand how to configure splash screen.

The issue is you can have invalid config and both the expo-doctor and provided TS types are allowing for such config, resulting in a cryptic error during build process. There is no mention that the backgroundColor is now required as previously in version 49, it wasn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

4 participants