As an Android developer, I have long been envious of XCode's ability to automatically generate rasterized images from a PDF. While there have been several attempts at replicating this behavior on Android with SVG images and the custom Android vector format, we at Vokal felt like something was still missing.
Our designers were constantly having to re-export images for Android in a different format - size, quality, scale, etc. We decided to take action and fill the void. Those who have used the scalable image tooling in XCode know that there is the ability to drop in PDFs rather than SVGs.
Today, we are introducing Android res-gen, a gradle plugin designed to provide scalable PDF support to projects. Our designers can now use a single set of assets for both iOS and Android. After setting up the gradle plugin, drop the PDFs into src/<flavor>/res-gen. The res-gen plugin by default will rasterize your images to PNG format. It also allows setting up filtering rules for images and backgrounds that should be exported as JPEG or mipmap.
We know that this will impact APK sizes and suggest using pure vector assets where possible. That said, for more complex imagery and backgrounds this has saved us countless hours of cutting images. We hope that others find this as useful as we have over the last year.
Learn more at https://www.github.com/vokal/android-res-gen