I am trying to build apk of my Flutter project but an error occurs and it fails to build

Issue

Microsoft Windows [Version 10.0.18363.778]
(c) 2019 Microsoft Corporation. All rights reserved.

F:\flutter_projects\i_am_rich>flutter build apk
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it’s recommended to use app bundles or split the APK to reduce the APK
size.
To generate an app bundle, run:
flutter build appbundle –target-platform android-arm,android-arm64,android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk –target-platform android-arm,android-arm64,android-x64 –split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Running Gradle task ‘assembleRelease’…

FAILURE: Build failed with an exception.

  • What went wrong:
    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
    F:\flutter_projects\i_am_rich\android\app\src\main\res\mipmap-xhdpi\ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.

    F:\flutter_projects\i_am_rich\android\app\src\main\res\mipmap-xhdpi\ic_launcher.png: AAPT: error: file failed to compile.
    

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

    F:\flutter_projects\i_am_rich\android\app\src\main\res\mipmap-mdpi\ic_launcher.png: AAPT: error: file failed to compile.
    

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

    F:\flutter_projects\i_am_rich\android\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png: AAPT: error: file failed to compile.
    

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

    F:\flutter_projects\i_am_rich\android\app\src\main\res\mipmap-xxhdpi\ic_launcher.png: AAPT: error: file failed to compile.
    
  • Try:
    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.

  • Get more help at https://help.gradle.org

BUILD FAILED in 2m 29s
Running Gradle task ‘assembleRelease’…
Running Gradle task ‘assembleRelease’… Done 152.6s (!)
Gradle task assembleRelease failed with exit code 1

F:\flutter_projects\i_am_rich>

Solution

I think you messed up with the icon files of your app. Try to replace the icon files.

Answered By – Raghav Joshi

Answer Checked By – Marie Seifert (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *