Thoughts on programming and more

Automatically exporting assets from Sketch into Android Studio

Matt Zanchelli wrote a blog post about automatically exporting assets from Sketch into Xcode, unfortunately this method can only be used with Xcode projects, but fortunately we have Gradle.

I ported this technique to use Gradle an achieve the same for Android Studio projects.

Installing Sketchtool

You have to install sketchtool first, it’s a tool by Bohemian Coding (the makers of Sketch), to work with .sketch tools on the command line. Download the Sketchtool and move the content of the directory into /usr/bin.

Alternatively, you can use this shell script, which basically does the same for you:

Screencast

Setting up the project

To organize the Sketch files, I created a subfolder in the root directory of the project and moved the AppIcon.sketch file into it. To create the image files of from the artboards in the file, we need a shell script. Create a AppIcon.sh file and copy the code below into the file.