Error while running EAS build for React Native Expo Execution failed for task ':app:mergeReleaseResources'

I tried building my app previously using EAS build there was no error but I guess when I changed my icon and splash images I am getting this error. Even though I checked everything like path to the icon and splash screen image, formatting conventions, resolutions etc.the error is still there. Below is the error that I received in Run gradlew.

[stderr]
FAILURE: Build completed with 2 failures.
[stderr]
1: Task failed with an exception.
[stderr]

[stderr]

  • What went wrong:
    [stderr]
    Execution failed for task ‘:app:mergeReleaseResources’.
    [stderr]

A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
[stderr]
Android resource compilation failed
[stderr]
ERROR:/home/expo/workingdir/build/android/app/build/generated/res/react/release/drawable-mdpi/src_assets_logo.png: AAPT: error: file failed to compile.
[stderr]

[stderr]

  • Try:
    [stderr]

Run with --stacktrace option to get the stack trace.
[stderr]
Run with --info or --debug option to get more log output.
[stderr]
Run with --scan to get full insights.
[stderr]
==============================================================================
[stderr]
2: Task failed with an exception.
[stderr]


[stderr]

  • What went wrong:
    [stderr]
    java.lang.StackOverflowError (no error message)
    [stderr]
  • Try:
    [stderr]

Run with --stacktrace option to get the stack trace.
[stderr]
Run with --info or --debug option to get more log output.
[stderr]
Run with --scan to get full insights.
[stderr]
==============================================================================
[stderr]

I am not sure whether the error occurred due to replacement of the icon and splash screen as the path and formats are as per the requirement. Below is my app.json file

{
“expo”: {
“name”: “medicine”,
“slug”: “medicine”,
“version”: “1.0.0”,
“orientation”: “portrait”,
“icon”: “./assets/icon.png”,
“userInterfaceStyle”: “light”,
“splash”: {
“image”: “./assets/splash.png”,
“resizeMode”: “contain”,
“backgroundColor”: “#ffffff
},
“assetBundlePatterns”: [
“**/*”
],
“ios”: {
“supportsTablet”: true,
“bundleIdentifier”: “ghritak.medicine”
},
“android”: {
“adaptiveIcon”: {
“foregroundImage”: “./assets/adaptive-icon.png”,
“backgroundColor”: “#ffffff
},
“package”: “ghritak.medicine”
},
“web”: {
“favicon”: “./assets/favicon.png”
},
“extra”: {
“eas”: {
“projectId”: “ccc84013-b406-45b4-a99a-3d4cf6197ae8”
}
}
}
}

Hi @ghritak

This happens if you have an image that is actually a JPEG or some other type of image, but the filename is something.png.

Look for a file called ./src/assets/logo.png. Then you should either convert it to a PNG, or rename it to the correct type.

If you’re on macOS or Linux you can use the file command to see the real file type.