Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting error while generating signed APK using Android studio

Here is the error that keeps coming up on the event log:

Generate Signed APK: Errors while building APK. You can find the errors in the 'Messages' view

And this in the messages:

Android resource compilation failed Output:

C:\Users\me\AndroidStudioProjects\SimpleCalculator2\app\src\main\res\mipmap-xxhdpi\ic_launcher.png: error: failed to read PNG signature: file does not start with PNG signature.

Command:

 C:\Users\me\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971- windows.jar\6c29a9fd1a7f2d4d5ddcbb0cbfa348c6\aapt2-3.2.0-4818971-windows\aapt2.exe compile --legacy\-o\

C:\Users\me\AndroidStudioProjects\SimpleCalculator2\app\build\intermediates\res\merged\release \

C:\Users\me\AndroidStudioProjects\SimpleCalculator2\app\src\main\res\mipmap-xxhdpi\ic_launcher.png

Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #0

like image 502
wizsab Avatar asked Jul 27 '26 07:07

wizsab


1 Answers

Just paste this in your build.gradle file

android {
    ....
    aaptOptions {
        cruncherEnabled = false
    }
    ....
}

This happens when you either rename an image or when you just cut and paste an image anywhere in the app folders, At Build time the compiler will complain about this.

like image 122
Barungi Stephen Avatar answered Jul 29 '26 20:07

Barungi Stephen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!