Reputation: 55
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
Upvotes: 3
Views: 6212
Reputation: 847
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.
Upvotes: 7
Reputation: 1009
Seeing your logs and as Praveen suggested:
I feel some PNG files are corrupted and were not parsed. Sometimes the images have an extension but are not real PNG.
You can check if the images in your project are real PNGs with the below command :
find . -type f -name "*.png" | xargs -L 1 -I{} file -I {} | grep -v 'image/png; charset=binary$'
After getting the list use this site to convert them to PNG.
Upvotes: 3
Reputation: 93
Cause:
It might be because you Stored the Image in another format with a .png extension.
Solution:
Don't just rename the file extension Convert your image file to .png format
Upvotes: 0