Failed to read PNG signature: file does not start with PNG signature
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
Error
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.res.Aapt2CompileRunnable
> Android resource compilation failed
ERROR:C:\Users\dharm\AndroidStudioProjects\webviewhospital\android\app\src\main\res\mipmap-mdpi\launcher_icon.png: AAPT: error: failed
to read PNG signature: file does not start with PNG signature.
ERROR:C:\Users\dharm\AndroidStudioProjects\webviewhospital\android\app\src\main\res\mipmap-mdpi\launcher_icon.png: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> Android resource compilation failed
ERROR:C:\Users\dharm\AndroidStudioProjects\webviewhospital\android\app\src\main\res\mipmap-hdpi\launcher_icon.png: AAPT: error: failed
to read PNG signature: file does not start with PNG signature.
ERROR:C:\Users\dharm\AndroidStudioProjects\webviewhospital\android\app\src\main\res\mipmap-hdpi\launcher_icon.png: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> Android resource compilation failed
ERROR:C:\Users\dharm\AndroidStudioProjects\webviewhospital\android\app\src\main\res\mipmap-xhdpi\launcher_icon.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.
ERROR:C:\Users\dharm\AndroidStudioProjects\webviewhospital\android\app\src\main\res\mipmap-xhdpi\launcher_icon.png: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> Android resource compilation failed
ERROR:C:\Users\dharm\AndroidStudioProjects\webviewhospital\android\app\src\main\res\mipmap-xxhdpi\launcher_icon.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.
ERROR:C:\Users\dharm\AndroidStudioProjects\webviewhospital\android\app\src\main\res\mipmap-xxhdpi\launcher_icon.png: AAPT: error: file
failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> Android resource compilation failed
ERROR:C:\Users\dharm\AndroidStudioProjects\webviewhospital\android\app\src\main\res\mipmap-xxxhdpi\launcher_icon.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.
ERROR:C:\Users\dharm\AndroidStudioProjects\webviewhospital\android\app\src\main\res\mipmap-xxxhdpi\launcher_icon.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
Solution:
You might have used a JPEG file or some other image file format.
Use PNG images to solve the error.
The drawable directory can only have png type of images.
If you are using an online platform to generate App Icon(launcher_icon), then use PNG Format or First convert JPEG to PNG and then used APP ICON GENERATOR
1
In my case also there was a jpg file instead of png, so I changed my extension and solve my problem.
Open [Root_project]/app/build.gradle and add following lines.
release {
...
crunchPngs false // or true
lintOptions {
checkReleaseBuilds false
abortOnError false
}
...
}
I have same error for slow i do some steps:
- open abc_btn_switch_to_on_mtrl_00001.9.png (Image)file in paint
- now select png and save as and re-save in Drawable and overwrite the old images and it works