Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic: Execution failed for task ':mergeDebugResources' (Some file crunching failed)

Ionic build command was working fine until I decided to add some custom splash screen and run the following command,

ionic resources

Post that every time I run build command, I got below error while running build command,

:mergeDebugResourcesAAPT err(Facade for 35126910): libpng error: Read Error FAILED

FAILURE: Build failed with an exception.

What went wrong:

Execution failed for task ':mergeDebugResources'.

Some file crunching failed, see logs for details

Try:

BUILD FAILED

So clearly, ionic resources command created some issues.

Please help!

like image 326
Gaurang Patel Avatar asked Nov 29 '22 23:11

Gaurang Patel


1 Answers

After going through multiple online resources, I found that ionic resources processes/optimizes the resultant PNG files. Post that, when you run ionic build android command, Android build itself tries to work on already processed/optimized Splash screens but it doesn't work well and it reports an error.

So, the fix is to tell Android Build not to touch those PNG files at all and go ahead with what it is given. How to do that?

Put cruncherEnabled = false in platforms\android\build.gradle file as below,

android {

aaptOptions {
cruncherEnabled = false
}

...

Re-run the build and it goes through without any problem! :)

like image 192
Gaurang Patel Avatar answered Dec 11 '22 01:12

Gaurang Patel