Skip to content

Instantly share code, notes, and snippets.

@granoeste
Created November 20, 2015 06:49
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save granoeste/af4bb6ebdecd6e8af630 to your computer and use it in GitHub Desktop.
Save granoeste/af4bb6ebdecd6e8af630 to your computer and use it in GitHub Desktop.
[Android] 9-Patch Validation
# ----------------------------------------------------------------
# Verifies the 9patch using aapt command
# ----------------------------------------------------------------
$ aapt
...
aapt c[runch] [-v] -S resource-sources ... -C output-folder ...
Do PNG preprocessing on one or several resource folders
and store the results in the output folder.
aapt s[ingleCrunch] [-v] -i input-file -o outputfile
Do PNG preprocessing on a single file.
...
# ----------------------------------------------------------------
# e.g. Single file
$ aapt s -i res/drawable-xxxhdpi/btn_on.9.png -o /dev/null
Crunching single PNG file: res/drawable-xxxhdpi/btn_on.9.png
Output file: /dev/null
ERROR: 9-patch image res/drawable-xxxhdpi/btn_on.9.png malformed.
No marked region found along edge.
Found along left edge.
# e.g. resource folders
$ aapt c -S res -C /var/tmp
Crunching PNG Files in source dir: res
To destination dir: /var/tmp
ERROR: 9-patch image res/drawable-hdpi/btn_on.9.png malformed.
No marked region found along edge.
Found along left edge.
ERROR: 9-patch image res/drawable-hdpi/btn_off.9.png malformed.
No marked region found along edge.
Found along left edge.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment