问题描述
我已经从 :
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
}
到:
dependencies {
classpath 'com.android.tools.build:gradle:1.4.0-beta3'
}
但我收到错误:
AAPT err(Facade for 1057495093): E:\android_studio_workspace\P2JN\p2jn\src\main\res\drawable-mdpi\reload_data.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
AAPT err(Facade for 1057495093): E:\android_studio_workspace\P2JN\p2jn\src\main\res\drawable\teamwork.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
AAPT err(Facade for 2049818754): E:\android_studio_workspace\P2JN\p2jn\src\main\res\drawable-hdpi\ic_action_update.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
AAPT err(Facade for 2049818754): E:\android_studio_workspace\P2JN\p2jn\src\main\res\drawable-ldpi\reload_data.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
AAPT err(Facade for 2049818754): E:\android_studio_workspace\P2JN\p2jn\src\main\res\drawable\get_started.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
编辑 buildToolsVersion 在我的 gradle 项目中:
edited buildToolsVersion on my gradle project:
buildToolsVersion "23.0.1"
那怎么解决?
推荐答案
这是一个警告,您的 png 图像有一些无效的元数据.最简单有效的解决方案是使用 pngcrush 和 optipng 实用程序.
It's a warning that you png images has some invalid metadata.Most simple and effective solution is to optimize your png images with pngcrush and optipng utilities.
运行
pngcrush -ow -rem allb -brute -reduce image.png
和
optipng -o7 image.png
在每个导致错误的图像上.
on every image that causes error.
在 macOS 和 Linux 上,您可以使用 bash 脚本查找当前目录及其所有子目录中的所有 png 图像并对其进行优化:
On macOS and Linux you can use bash script that finds all png images in current directory and all its subdirectories and optimizes them:
#!/bin/sh
for i in `find . -name "*.png"`; do
pngcrush -ow -rem allb -brute -reduce $i
optipng -o7 $i
done
对于 Windows,将以下内容保存到批处理文件并运行:
And for Windows save the following to batch file and run:
@echo off
set /p UserInputPath= What Directory would you like?
cd %UserInputPath%
for /r %%i in (*.png) do ( pngcrush -ow -rem allb -brute -reduce "%%i" & optipng -o7 "%%i" )
要在 macOS 上安装 pngcrush
和 optipng
,请使用 Homebrew 包管理器:
To install pngcrush
and optipng
on macOS use Homebrew package manager:
brew install pngcrush optipng
这篇关于Android Studio:“libpng 警告:iCCP:无法识别已编辑的已知 sRGB 配置文件"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!