Amay Diam
Amay Diam

Reputation: 2601

Android Studio: “libpng warning: iCCP: Not recognizing known sRGB profile that has been edited”

I have upgrade gradle from :

dependencies {
        classpath 'com.android.tools.build:gradle:1.3.1'
    }

to :

dependencies {
        classpath 'com.android.tools.build:gradle:1.4.0-beta3'
    }

but I getting error :

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

edited buildToolsVersion on my gradle project:

buildToolsVersion "23.0.1"

so how to fix it ?

Upvotes: 3

Views: 8594

Answers (3)

mixel
mixel

Reputation: 25846

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.

Run

pngcrush -ow -rem allb -brute -reduce image.png

and

optipng -o7 image.png

on every image that causes error.

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

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" )

To install pngcrush and optipng on macOS use Homebrew package manager:

brew install pngcrush optipng

Upvotes: 8

Haggai
Haggai

Reputation: 474

This has to do with upgrading the png library to 6.0 - it interpret the png files in a different way.

to fix it you should go through all of your png file to fix it.

Here is how I did it from command line:

brew install exiftool
cd /Drawable
find . -name "*.png" -exec exiftool -overwrite_original -all= "{}" ";"

Upvotes: 0

Hoshouns
Hoshouns

Reputation: 2430

you should move the app icons to mipmap folder.

It’s best practice to place your app icons in mipmap- folders (not the drawable- folders) because they are used at resolutions different from the device’s current density.

Upvotes: 0

Related Questions