无法读取PNG签名:文件不是以PNG签名开头

编程入门 行业动态 更新时间:2024-10-11 13:28:01
本文介绍了无法读取PNG签名:文件不是以PNG签名开头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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:

  • 使缓存无效/重新启动
  • 删除gradle文件夹
  • 推荐答案

    也许它实际上不是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签名开头

    本文发布于:2023-11-24 17:04:25,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1626089.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:开头   文件   PNG

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!