Mark Kortink
Mark Kortink

Reputation: 2120

How to make Android Studio create icons from SVG file

I am relatively new to Android Studio and am having trouble getting the launch icon working properly.

  1. Initially my icon file is an SVG called icon.svg. Using [File > New > Vector Asset] adds the icons without error and I can see all the mipmap ic_launcher files and they appear to be PNG files. However when I build, upload and install the apk to Android I get the green hatch background with no icon.

  2. Next I try converting the SVG to a PNG in my assets folder. This time [File > New > Image Asset] adds the icons without error and I can see all the mipmap ic_launcher files again, they appear to be PNG files. This time when I build, upload and install the apk to Android I get the icon but the green hatch background is showing behind it.

All my source images for my app are SVGs. Ideally what I would like to be able to do is generate all the Android icons from my icon.svg file and have them display without the green hatch background.

Here are some screen shots to show what I am seeing in Android Studio.

The assets and ic_launcher files

Geen hatch background on one of the ic_launcher pngs

Upvotes: 4

Views: 2905

Answers (1)

Marçal A. B.
Marçal A. B.

Reputation: 21

That green hatch background is the file you have in the drawable folder named ic_launcher_background.xml, this file is added as default background if you don't modify the tab Background Layer when you are in Configure Image Asset [File>New>Image Asset].

Upvotes: 1

Related Questions