Expo Build Fails For Production

Hi,

I’m trying to build the aab for android on production, but keeps getting the error “ssets_images_registration.png: AAPT: error: file failed to compile.” when running : eas build -p android --profile production

Everything works fine when same is built for development.
I’ve already tried to change all the image from jpg to png and also the image sizes, but still facing same issues.

Appreciate if if someone can help.

Below is the error:
[stderr]

FAILURE: Build completed with 2 failures.
1764[stderr] 1: Task failed with an exception.
1765[stderr] -----------
1766[stderr] * What went wrong:
1767[stderr] Execution failed for task ':app:mergeReleaseResources'.
1768[stderr] > A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
1769[stderr]    > Android resource compilation failed
1770[stderr]      ERROR:/home/expo/workingdir/build/mobile-app-paywise/android/app/build/generated/res/react/release/drawable-mdpi/assets_images_registration.png: AAPT: error: file failed to compile.
1771[stderr]
1772[stderr] * Try:
1773[stderr] > Run with --stacktrace option to get the stack trace.
1774[stderr] > Run with --info or --debug option to get more log output.
1775[stderr] > Run with --scan to get full insights.
1776[stderr] ==============================================================================
1777[stderr] 2: Task failed with an exception.
1778[stderr] -----------
1779[stderr] * What went wrong:
1780[stderr] java.lang.StackOverflowError (no error message)
1781[stderr] * Try:
1782[stderr] > Run with --stacktrace option to get the stack trace.
1783[stderr] > Run with --info or --debug option to get more log output.
1784[stderr] > Run with --scan to get full insights.
1785[stderr] ==============================================================================
1786[stderr] * Get more help at https://help.gradle.org
1787[stderr] BUILD FAILED in 6m 52s

Hi @tushal_paywise

As far as I know this means that you have a file called assets/images/registration.png that is in fact not a PNG.

If you’re on macOS or Linux you can try running file assets/images/registration.png to see what type it is. If it’s actually a JPEG then you can rename it and fix the name in your code too.

1 Like

Hi @wodin,

Thank you so much, it worked.
Been struggling to resolve this issue :grinning:
Cheers

1 Like