Last active
August 29, 2015 14:06
-
-
Save ksc91u/37513796b2cec37bb3c5 to your computer and use it in GitHub Desktop.
aapt ERROR: 9-patch image malformed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# 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; | |
if($argv=~m/\.9\.png/){ | |
$aapt = abs_path($0).".17"; #old aapt does not check 9 patch image | |
exec($aapt, @args); | |
}else{ | |
$aapt = abs_path($0).".20"; | |
exec($aapt, @args); | |
} |
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
Might cause error generating AndroidManifest.xml when running on jenkins.