Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
aapt ERROR: 9-patch image malformed
# Fix the following error, using gradle or Android Studio to build some projects with malformed 9 patch image
# aapt ERROR: 9-patch image malformed
# Frame pixels must be either solid or transparent (not intermediate alphas).
# put the file as sdk/build-tools/20.0.0/aapt and original aapt as aapt.20
# put the file as sdk/build-tools/17.0.0/aapt and original aapt as aapt.17
# force use aapt cruncher by adding:
# android.aaptOptions.useAaptPngCruncher = true
# in your build.gradle
use Cwd 'abs_path';
use Getopt::Long;
use File::Copy;
$argv = join(" ", @ARGV);
@args = @ARGV;
$aapt = abs_path($0).".17"; #old aapt does not check 9 patch image
exec($aapt, @args);
$aapt = abs_path($0).".20";
exec($aapt, @args);
Copy link

ksc91u commented Sep 23, 2014

Might cause error generating AndroidManifest.xml when running on jenkins.

Copy link

ksc91u commented Sep 26, 2014

Perl too slow, write a bash version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment