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

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

Gradle 构建失败并出现此错误:

Gradle build failing with this error:

Error:C:UsersRoman.gradlecaches ransforms-1files-1.1appcompat-v7-26.0.2.aarab547c3f1b8061ef9426f524a823a15esdrawable-xhdpi-v4abc_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:devworkspaceandroid2MatrixCalculatorappuildintermediatesesmergeddebug C:UsersRoman.gradlecaches ransforms-1files-1.1appcompat-v7-26.0.2.aarab547c3f1b8061ef9426f524a823a15esdrawable-xhdpi-v4abc_btn_switch_to_on_mtrl_00001.9.png Issues: - ERROR: C:UsersRoman.gradlecaches ransforms-1files-1.1appcompat-v7-26.0.2.aarab547c3f1b8061ef9426f524a823a15esdrawable-xhdpi-v4abc_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文件夹
  • 推荐答案

    很可能将 JPG 重命名为 PNG 文件,而不是实际的 PNG 文件问题可能是因为图像的扩展名错误.就我而言,该文件是一个 JPEG 图像,但它保存为 PNG 未转换为.在这种情况下,将扩展名更改为真实的扩展名并转换为 PNG,然后重试.

    It's likely a JPG renamed to a PNG file, not an actual PNG file 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:01,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1626088.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:开头   文件   PNG

    发布评论

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

    >www.elefans.com

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