How to Get Rid of mdpi, hdpi, xhdpi, xxhdpi… Use Vector Assets in Your Android Projects

Quick note: If you are a designer than share this link with your Android engineers and never again bother with slicing assets for different device density screens.

In Android app development, it’s a good practice to support multiple screens. And even if you’re making an app only for smartphones and only for a portrait mode, you have to deal with different screen densities. So, you open your design file in Photoshop or Sketch, and start extracting assets, adding all those multipliers for mdpi, hdpi, xhdpi, xxhdpi and now also xxxhdpi (!) device density.

It’s a dull and tedious process. App developers and designers even have created scripts and plugins for that.

But I will share with you a few hacks on how to make this easier!

Here is what you need:

  • Android Studio 1.4
  • Android Gradle plugin 1.5.0

Open your design files and export your assets in .svg format. Now in Android Studio right click on res folder → new → Vector Asset. This will open Vector Asset Studio and you can select one of the default material icons, in case you need one, or you can import your svg file.

A hint: if Android Vector Studio says there is an error importing your file, no worries, there is a plenty of online resources to help you with vector drawables. Or you can open your svg file and copy pathData into your vector drawable.

That’s it! Now you have only one resource for each asset.

Android Vector Assets

In reality though, vector drawables are supported only on Android 5.0, api level 21, so what happens is that gradle plugin renders all that drawables for different densities to package them into resulting .apk file to be displayed on older versions.

What hacks for working with drawables and supporting multiple screens do you know? Let us know in the comments below.

Subscribe to updates
Share this article

Contact me About

By sending this form I confirm that I have read and accept Intellectsoft Privacy Policy

Something went wrong. Send form again, please.

Thank you for your message!

We will get in touch with you regarding your request within one business day.

Send again

What happens next?

  • Our sales manager reaches you out within a few days after analyzing your business requirements
  • Meanwhile, we sign an NDA to ensure the highest privacy level
  • Our pre-sale manager presents project estimates and approximate timeline