expo build:android error

For some strange reason, my standalone android build will fail if I use any image other that the default one as the splash image.

And I would get the error below:

[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ‘:app:mergeProdKernelReleaseResources’.
[stderr] >
[stderr] java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
[stderr] Output: /app/workingdir/android/sdk32/android-shell-app/app/src/main/res/drawable-xxxhdpi/shell_launch_background_image.png: error: failed to read PNG signature: file does not start with PNG signature.
[stderr]
[stderr] Command: /root/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-linux.jar/84b76afa7d0c48bd9c8191ef4eb60805/aapt2-3.2.1-4818971-linux/aapt2 compile --legacy
[stderr] -o
[stderr] /app/workingdir/android/sdk32/android-shell-app/app/build/intermediates/res/merged/prodKernel/release
[stderr] /app/workingdir/android/sdk32/android-shell-app/app/src/main/res/drawable-xxxhdpi/shell_launch_background_image.png
[stderr] Daemon: AAPT2 aapt2-3.2.1-4818971-linux Daemon #5
[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 27s
17 actionable tasks: 17 executed

I have made sure that my image is indeed a PNG. So it definitely is NOT some jpg saved as PNG. Everything works just fine on Expo Client, and I have spent more than 3 hours trying to fix this, but no luck whatsoever.

This is a sample failed build: https://expo.io/builds/0c20dc5d-a777-4265-aa30-f3aa4f07bf11

Hello Matt,
I had the same error, maybe this will help.

Had something to do with using the wrong version of react-native, so new assets were not uploaded.

Greetings

Thank you! But I had to use RN 0.57.8 in order to use some other packages that were quite essential to our app, Maybe I will find a way around it if nothing can be done, haha.

Bump :slight_smile:

Just wondering if the Expo developers have noticed this issue, and if so, will there be any sort of resolutions? I would love to be able to use my custom splash image.

the file that you are providing is not a png as the error message suggests. make sure you use an actual png image and not a file renamed to have a png extension :wink:

Hi! The first post in this thread explained that I have made SURE that the image is indeed a png, I checked with both photoshop and GIMP. But thank you for your help still~

can you share the image somewhere?

Of course, can I maybe send it to you directly over the expo Slack channel?

it would be ideal if you could upload somewhere and share here, or create a github issue and put it there. this would allow for all of the context around your issue to be in one place

Sorry for the late reply, here is an image that could reproduce our problem, thanks a bunch!

Bump bump, has there been any resolution to this issue? Thanks!

i was able to build for android and ios using that image as my splash screen

I think the problem with me is that I am using React Native 0.57.8 with Expo 32, this is not the officially supported combination but I needed it for something. Was there any insight looking into the specific build log that I provided?

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