Question

I created the folders:

app_name/res/drawable-hdpi
app_name/res/drawable-mdpi
app_name/res/drawable-ldpi

I put icons 72x72 in hdpi, 48x48 in mdpi, and 36x36 in ldpi. I named the png icons: icon.png

I compiled and ran it and the icons didn't change. So then I went to AndroidManifest.xml and changed the icon parameter:

<application
        android:icon="@drawable-ldpi/icon"
...

However I get this error:

Error: No resource found that matches the given name (at 'icon' with value '@drawable-ldpi/icon'). AndroidManifest.xml

Any tips?

Was it helpful?

Solution

adding the dpi to the drawable is invalid. You should just be able to set it like so in the manifest:

<Application
  ...
  android:icon="@drawable/ic_launcher" > 
  <!-- change ic_launcher to whatever your png is named -->

The typical folder structure is as follows:

/
  AndroidManifest.xml
  /res
    /drawable-ldpi
      ic_launcher.png       # 36x36
    /drawable-mdpi
      ic_launcher.png       # 48x48
    /drawable-hdpi
      ic_launcher.png       # 72x72

Once you've done this, you'll probably need to do a clean (eclipse -> project -> clean), but you'll know it was successful if a line like this appears in your /gen/R.java file:

public static final int ic_launcher = 0x...;

If it isn't, you can delete the R.java file and the ADT will immediately panic and rebuild it from scratch, incorporating your new drawables.

As a final note, sometimes the emulator seems to cling to the old icon - the clean should make it change, but if it doesn't, go into settings and uninstall the application and then run again from eclipse, everything should REALLY be clean (the same applies to actual devices as well)

NOTE the answer now includes the comments below

OTHER TIPS

make sure you have refreshed your Android project. You might try changing the name of your icon files to "ic_launcher.png" which is the name used now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top