Google Play says I have invalid icon

FigmoFigmo Figmo justfigmoUGMember

I am trying to upload my first app to Google play. It says the icon is invalid. I need a clarification on icons. The docs say I need icons of 36x36, 48x48, 72x72 and 96x96. My manifest file only specifies one icon - it is 72x72 in size. Here is my AndroidManifest.xml from Visual Studio:

Where do I specify the other sizes? Do I just add multiple <application..../> lines in the .xml file for each icon?


  • TomOpgenorthTomOpgenorth Tom Opgenorth CAMember, Xamarin Team Xamurai

    The snippet from your manifest isn't showing up in your post. However, you can only have one <application /> element in your manifest.

    Creating the icons is pretty easy with the Android Asset Studio, it will make them the appropriate size.

    As for setting the icon, check out the Hello, World Walkthrough section in the Hello, World article.

  • FigmoFigmo Figmo justfigmo UGMember

    Cool info. I didn't use Asset Studio because I don't have Chrome and it doesn't work with my browser. But I can resize PNG's easy enough (if that is all there is to it).

    The hello world example does show how to add an icon. And I did that right off when I first started my first project. But what has me confused is: HOW TO ADD MORE THAN ONE ICON?

    Or maybe I'm not understanding what Google is expecting of me. The docs say "An application should have icons for all of the generalized screen densities as outlined in the table below" (and it shows 4 different sizes) So I am assuming I need 4 icons of the 4 specified sizes in my app.

    But which size do I list in the xml file for the icon line you pointed out above?

    And where do I specify the names of the other sizes?

    BTW: originally I created my project with VS2012. And it only gave me a Drawable folder under Resources. I notice in the hello world app there are other folders (drawable-ldpi, drawable-mdpi, etc). Could it be these folder names are required and that is how Android finds the other sizes of icons?

  • FigmoFigmo Figmo justfigmo UGMember

    Clarification: hello world DOES show **ADDING **more than 1 icon. But that is it. So unless my last paragraph was correct and it is the existence and the name of these other folders that is important - that is what has me confused.

  • TomOpgenorthTomOpgenorth Tom Opgenorth CAMember, Xamarin Team Xamurai

    Yes, you will need to create the folders for each density:


    Put the icons of the appropriate size in their folder. All you have to do is refer to the icon using the syntax @drawable/ic_launcher (or what ever you named your icon). Android will figure out what folder the icon is in and use that.

    You might find it worth while to check out Xamarin's Resources document.

  • FigmoFigmo Figmo justfigmo UGMember

    OK - makes sense. One last question. do I even need the the Resources/drawable folder that was created by the VS2012 wizard? Or do I just delete that after creating the new folder tree?

  • TomOpgenorthTomOpgenorth Tom Opgenorth CAMember, Xamarin Team Xamurai

    Technically, you don't need it. Personally, I keep it around, and copy the files from my drawable-mdpi folder into drawable. If for some crazy reason Android can't find a drawable folder that matches your device, then it will use the images in drawable. If the drawable folder doesn't exist, then your application will crash.

  • NicollasRicasNicollasRicas Nicollas Ricas BRMember ✭✭
    edited June 2013

    If you have drawable folder it will ignore all specific density drawable folders.

    Delete drawable folder and create a following folders:

    drawable-ldpi (36x36)

    drawable-mdpi (48x48)

    drawable-hdpi (72x72)

    drawable-xhdpi (96x96)

    drawable-xxhdpi (144x144)

  • TomOpgenorthTomOpgenorth Tom Opgenorth CAMember, Xamarin Team Xamurai

    @NicollasRicas the presence of the drawable folder does not mean that all other drawable folders are ignored. How Android decides what resources folder will be used can be a bit of a convoluted process. Part 3 - Alternate Resources of Xamarin's documentation provides a description and an example of how Android determines what resources to load on a particular device.

  • NicollasRicasNicollasRicas Nicollas Ricas BRMember ✭✭
    edited June 2013

    @topgenorth look at Android Resources documentation. If you look in all xamarin document examples, drawable folder not exist when drawable-ldpi and others are created.

    I tested this creating all specific drawable folders and put image with different color each one.

  • TomOpgenorthTomOpgenorth Tom Opgenorth CAMember, Xamarin Team Xamurai

    Basically, we're both right. The odds are that Android may not the contents of the drawable folder if all the other density specific alternative resources are provided, you are better off keeping the drawable folder around. This is kind of long winded, so please bear with me.

    The drawable folder provides the default drawable resources that Android can use if, for some strange reason, cannot find a matching alternative resource. Alternate resources are those resources that are accompanied by a resource qualifier, i.e. -xlarge or -sw600dp, -en_CA, etc. Providing the default folder for a given resource is a defensive technique. Google does flat out say this in the document Providing Resources document:

    Always include default resources so your app does not depend on specific device configurations


    To avoid any issues, always include a set of default resources (a set of resources with no qualifiers).


    Providing default resources is important not only because your application might run on a configuration you had not anticipated, but also because new versions of Android sometimes add configuration qualifiers that older versions do not support. If you use a new resource qualifier, but maintain code compatibility with older versions of Android, then when an older version of Android runs your application, it will crash if you do not provide default resources, because it cannot use the resources named with the new qualifier.


    So, in order to provide the best device compatibility, always provide default resources for the resources your application needs to perform properly. Then create alternative resources for specific device configurations using the configuration qualifiers.

    Now, this is Android so things aren't quite so black and white. Density specific drawables are a bit different from regular resources in that Android might ignore the default resources to load a drawable from another folder that it can more effectively scale. To quote Google's documentation on Supporting Multiple Screens :

    If no matching resource is available, the system uses the default resource and scales it up or down as needed to match the current screen size and density


    The "default" resources are those that are not tagged with a configuration qualifier. For example, the resources in drawable/ are the default drawable resources. The system assumes that default resources are designed for the baseline screen size and density, which is a normal screen size and a medium density. As such, the system scales default density resources up for high-density screens and down for low-density screens, as appropriate.


    However, when the system is looking for a density-specific resource and does not find it in the density-specific directory, it won't always use the default resources. The system may instead use one of the other density-specific resources in order to provide better results when scaling. For example, when looking for a low-density resource and it is not available, the system prefers to scale-down the high-density version of the resource, because the system can easily scale a high-density resource down to low-density by a factor of 0.5, with fewer artifacts, compared to scaling a medium-density resource by a factor of 0.75.

    So, the key phrase here is "when the system is looking for a density-specific resource and does not find it in the density-specific directory, it won't always use the default resources". This is why it appears that the drawable folder is ignored - Android actually has a bit of a choice here in deciding which drawable resource to load and then scale (if necessary).

    I'd like to think that is to try and future proof your application. Say, for example, the next version of Android introduces the xxxhdpi resource qualifier. Your application won't crash because the system has a bit of flexibility in choosing an alternative drawable that is more suitable to scaling. Perhaps Android might be able to load resources from the xhdpi folder and scale them, but if nothing else it can always fall back on the drawable folder.

    Given that it's pretty trivial to create a drawable folder and then alias the resources as appropriate, it's a pretty low cost way to future-proof your application.

    Hope this helps you understand why I say it's a good idea to keep the drawable folder around.

  • NicollasRicasNicollasRicas Nicollas Ricas BRMember ✭✭

    @topgenorth thanks, now i understand why it's better keep drawable folder.

Sign In or Register to comment.