Search code examples
javaandroidflutterdartflutter-dependencies

Flutter Execution failed for task ':app:mergeReleaseResources'


Multiple task action failures occurred: A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade > Android resource compilation failed AAPT: D:\Flutter Projects\Areading-master\android\app\src\main\res\mipmap-hdpi\ic_launcher.png: error: failed to read PNG signature: file does not start with PNG signature. D:\Flutter Projects\Areading-master\android\app\src\main\res\mipmap-hdpi\ic_launcher.png: error: file failed to compile.

   > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
      > Android resource compilation failed
        AAPT: D:\Flutter Projects\Areading-master\android\app\src\main\res\mipmap-xhdpi\ic_launcher.png: error: failed to read PNG signature: file does not start with PNG signature.
        D:\Flutter Projects\Areading-master\android\app\src\main\res\mipmap-xhdpi\ic_launcher.png: error: file failed to compile.


   > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
      > Android resource compilation failed
        AAPT: D:\Flutter Projects\Areading-master\android\app\src\main\res\mipmap-xxhdpi\ic_launcher.png: error: failed to read PNG signature: file does not start with PNG signature.
        D:\Flutter Projects\Areading-master\android\app\src\main\res\mipmap-xxhdpi\ic_launcher.png: error: file failed to compile.


   > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
      > Android resource compilation failed
        AAPT: D:\Flutter Projects\Areading-master\android\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png: error: failed to read PNG signature: file does not start with PNG signature.
        D:\Flutter Projects\Areading-master\android\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png: error: file failed to compile.


   > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
      > Android resource compilation failed
        AAPT: D:\Flutter Projects\Areading-master\android\app\src\main\res\mipmap-mdpi\ic_launcher.png: error: failed to read PNG signature: file does not start with PNG signature.
        D:\Flutter Projects\Areading-master\android\app\src\main\res\mipmap-mdpi\ic_launcher.png: error: file failed to compile.

This Error Happened when I try to build the project by this command flutter build apk --split-per-abi I don't know what is that about? please Help.


Solution

  • The builder optimizes the images in your app, in this case the png images. This is to reduce the size of the apk. It is unable to do so in your case. To run without optimization you can put the following in your build.gradle

    android {
    buildTypes {
        release {
            crunchPngs false // or true
        }
      }
    }