Export Android resources in Sketch – PNG assets, app icon, nine-patch image, shape XML, color resource xml and vector drawable.
- Export PNG assets into multiple sizes.
- Preview and export nine-patch assets into multiple sizes.
- Export app launcher icon for Android 8 and older version.
- View and export shape drawable XML code.
- Export vector drawable asset.
- Compress PNGs after export use ImageOptim.
- View and export color resource XML code from Sketch document colors or selected layers.
- Search "Android Res Export" from Sketch Runner, Sketchpacks or Sketch Toolbox.
- Download master.zip and unzip, then double-click "Android_Res_Export.sketchplugin" to install.
Install Command Line Tools.
xcode-select --install
Install Homebrew.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
After hombrew installed, use this command to install ImageMagick.
brew install imagemagick
Install Node.js. Then use this command to install SVGO and svg2vectordrawable.
npm install -g svgo svg2vectordrawable
Design at MDPI (1x) size, NOT support for other sizes. Download demo.sketch
Use menu "Plugins" - "Android Res Export" - "New PNG Asset" to create PNG assets.
Use menu "Plugin" - "Android Res Export" - "New Nine-Patch Asset" to create a nine-patch asset. Run "Nine-Patch Preview " for preview the nine-patch assset.
Use menu "Plugin" - "Android Res Export" - "New Vector Drawable Asset" to create a vector drawable asset.
If you want to support Android API < 24 (7.0), select the shape layers in vector drawable group, click the settings icon in fill property panel, and choose "Non-Zero".
Before export the assets, you must create them use "New ... Asset" in plugin menu. Selected the spical asset layer group, then run "Export ... Assets" to export them, and deselected all to export all assets.
For app icons, you need to selected the template page, before run the "Export App Icon".
Apache 2.o