failed to read PNG signature: file does not start with PNG signature.

I have a problem on build android stand alone. it return an error message as below

[stderr] FAILURE: Build failed with an exception.

[stderr] * What went wrong:

[stderr] Execution failed for task ‘:app:mergeReleaseResources’.

[stderr] > java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed

[stderr] /app/turtle/workingdir/android/sdk33/android-shell-app/app/src/main/res/drawable-mdpi/shell_launch_background_image.png: error: failed to read PNG signature: file does not start with PNG signature.

[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 1m 27s

I’ve tried export my splash PNG file using multiple different software and non of them work. I am 100% sure it is a PNG not JPG image.

I’ve also tried to remove splash settings from app.json and it will build without any problem.

You can see the build error logs here
https://expo.io/builds/80b702bf-c7ef-4b43-9183-0d97276259b4

My app.json file and png image also attached. Also hint to solve this problem will be much appreciate.

{
“expo”: {
“name”: “Volleyball NZ”,
“description”: “Volleyball NZ”,
“slug”: “XXXXXXX”,
“privacy”: “unlisted”,
“sdkVersion”: “33.0.0”,
“platforms”: [“ios”, “android”,“web”],
“version”: “1.0.6”,
“orientation”: “portrait”,
“scheme”: “XXXXX”,
“icon”: “./assets/icons/app-icon.png”,
“splash”: {
“image”: “./assets/splash.png”,
“resizeMode”: “contain”,
“backgroundColor”: “#fff
},
“updates”: {
“enabled”: false,
“checkAutomatically”: “ON_ERROR_RECOVERY”,
“fallbackToCacheTimeout”: 0
},
“assetBundlePatterns”: [
“assets/"
],
“ios”: {
“supportsTablet”: false,
“buildNumber”: “104”,
“bundleIdentifier”: “com.maxgen.volleyballnz”,
“icon”: “./assets/icons/app-icon.png”,
“splash”: {
“resizeMode”: “cover”,
“backgroundColor”: “#ef4823”,
“image”: “./assets/splash.png”,
}
},
“android”: {
“package”: “com.maxgen.volleyballnz”,
“versionCode”: 104,
“icon”: “./assets/icons/app-icon.png”,
“permissions”: [
“READ_INTERNAL_STORAGE”,
“VIBRATE”,
“com.google.android.c2dm.permission.RECEIVE”
],
},
“androidStatusBar”: {
“barStyle”: “light-content”,
“backgroundColor”: “#000000
},
“assetBundlePatterns”: [
"assets/

]
}
}

Hey @maxgendaniel,

Can you ensure your image file is a real .png file and not another type that has been renamed?

Cheers,
Adam

Yes I use photoshop and save as png file, also tried few online tools and export png file. I used to this png file and build app without problem until I upgrade to sdk 33

I’ve successfully buIld iOS app as well, so I feel this is related to sdk33 maybe?

assetBundlePatterns is a glob pattern not path to directory, and you have added it twice to your app.json

{
  “assetBundlePatterns”: [
    "assets/**/*”
  ]
}
1 Like

Thank you whizyra,

I’ve tried to remove extra assetBundlePattern and change the pattern to assets/*, however, I am still getting the same error in the android build.

Check the build log here. https://expo.io/builds/969ac60f-e7dd-4bd0-8523-300ea6e26a5c.

Below is my updated app.json
{
“expo”: {
“name”: “Volleyball NZ”,
“description”: “Volleyball NZ”,
“slug”: “volleyballnz”,
“privacy”: “unlisted”,
“sdkVersion”: “33.0.0”,
“platforms”: [“ios”, “android”,“web”],
“version”: “1.0.6”,
“orientation”: “portrait”,
“scheme”: “volleyballnz”,
“icon”: “./assets/icons/app-icon.png”,
“splash”: {
“image”: “./assets/splash.png”,
“resizeMode”: “contain”,
“backgroundColor”: “#fff
},
“updates”: {
“enabled”: false,
“checkAutomatically”: “ON_ERROR_RECOVERY”,
“fallbackToCacheTimeout”: 0
},
“assetBundlePatterns”: [
“assets/*”
],
“ios”: {
“supportsTablet”: false,
“buildNumber”: “104”,
“bundleIdentifier”: “com.maxgen.volleyballnz”,
“icon”: “./assets/icons/app-icon.png”,
“splash”: {
“resizeMode”: “cover”,
“backgroundColor”: “#ef4823”,
“image”: “./assets/splash.png”,
}
},
“android”: {
“package”: “com.maxgen.volleyballnz”,
“versionCode”: 104,
“icon”: “./assets/icons/app-icon.png”,
“permissions”: [
“READ_INTERNAL_STORAGE”,
“VIBRATE”,
“com.google.android.c2dm.permission.RECEIVE”
],
},
“androidStatusBar”: {
“barStyle”: “light-content”,
“backgroundColor”: “#000000
}
}
}

If I removed splash setting from app.json then I can build without problem… no problem with iOS build.

Any chance you can offer more hints about this issue?

Cheers,
Daniel

It should be assets/**/*, single * matches only files in current directory ** matches all directories recursively.
When your app is published splash screen is supposed be here https://d1wp6m56sqw74a.cloudfront.net/~assets/918f421e4ec881335727072a72a40ba6, but there is nothing there. Are you sure that path to splash screen is correct (in you first post you included .jpg file)? What happens when you ran expo export? Is dist directory contains splash screen?

1 Like

Hi Wakozyra,

Thanks for great support!

I’ve update the budleasset settings, also run expo optimize in CLI to optimize all asset images, and it seems working fine now.

Thank you so much and hope my experience can help others as I do see other similar posts.

1 Like

Glad you got it sorted out! Thanks for the assist, @wkozyra!

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