Gradle构建因此错误而失败:
Gradle build failing with this error:
Error:C:\Users\Roman\.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.0.2.aar\bab547c3f1b8061ef9426f524a823a15\res\drawable-xhdpi-v4\abc_btn_switch_to_on_mtrl_00001.9.png failed to read PNG signature: file does not start with PNG signature Error:java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed: Error:Execution failed for task ':app:mergeDebugResources'. Error: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.internal.aapt.AaptException: AAPT2 compile failed: aapt2 compile --legacy -o C:\dev\workspace\android2\MatrixCalculator\app\build\intermediates\res\merged\debug C:\Users\Roman\.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.0.2.aar\bab547c3f1b8061ef9426f524a823a15\res\drawable-xhdpi-v4\abc_btn_switch_to_on_mtrl_00001.9.png Issues: - ERROR: C:\Users\Roman\.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.0.2.aar\bab547c3f1b8061ef9426f524a823a15\res\drawable-xhdpi-v4\abc_btn_switch_to_on_mtrl_00001.9.png failed to read PNG signature: file does not start with PNG signature我已尝试解决此问题的一些基本方法:
Some basic things i've tried to solve this issue:
推荐答案
也许它实际上不是PNG,而是重命名为PNG的JPG. 问题可能是由于图像扩展名错误. 就我而言,该文件是一个JPEG图像,但是它被保存为PNG而不被转换为.在这种情况下,将扩展名更改为真实扩展名,然后转换为PNG,然后重试.
Perhaps it's not actually a PNG, but a JPG renamed to PNG. The problem could be because of the wrong extension of images. In my case, the file was a JPEG image but it was saved as PNG not converted to. In this situation change extension to the real one and convert to PNG then retry.
例如,您有ic_logo.png,但实际上是JPG图像. 您应该将其重命名为ic_logo.jpg并使用Photoshop之类的格式将图像转换为PNG格式.
For instance, you have ic_logo.png but it's actually a JPG image. You should rename it back to ic_logo.jpg and use something like Photoshop to convert the image to PNG format.
更多推荐
无法读取PNG签名:文件不是以PNG签名开头
发布评论