简体   繁体   中英

Android Launcher Icon not working

I have an Android app that I am currently developing. I have created icons (.png) and placed them in the /res/drawable-hdpi (and ldpi & mdpi) folders. In my manifest I have

<application android:icon="@+drawable/icon" android:label="@string/app_name">

my icons are all named icon.png.

I have compiled the source and when I run it on the emulator, the icon shows up in the desktop launcher. But when I copy the apk to my actual phone, the desktop launcher shows the default package icon rather than my custom icon. Although, funny enough when I am actually installing the app, the package manager does show the icon. But once it is installed, the icon does not show.

How do I make my application icon show up as the launcher icon?

Skip

删除“@ + drawable / icon”中的“+”

I had the same problem, and I never used the "+" in the manifest. Rebooting&wiping emulator or restarting Eclipse did not work for me.

I simply solved renaming all the icon.png files to something different (eg iconq.png).

I just had the same issue. I renamed my icon to launch_icon and restarted Eclipse. Not sure which one did the trick but it worked after that

Make sure that the Intent of your Launcher Activity is named MAIN ie,

<intent-filter>
            <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

Moreover, add the icon to your Drawable folders and then refer it in the application block of Manifest.

<application
    android:allowBackup="true"
    android:icon="@drawable/icon"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

In my case, I was testing in a Nexus 5X device with the Android Nougat and the icon was correct, but in the emulator on the same android version but with the Pixel Launcher, the default icon were shown. I saw that in my case I forgot to replace the android:roundIcon property in the manifest to use the new one.

Round Icon Resources

Apps can now define circular launcher icons, which are used on devices that support them. When a launcher requests an app icon, the framework returns either android:icon or android:roundIcon, depending on the device build configuration. Because of this, apps should make sure to define both android:icon and android:roundIcon resources when responding to launcher intents. You can use Image Asset Studio to design round icons.

You should make sure to test your app on devices that support the new circular icons, to see how your circular app icons look and how they are displayed. One way to test your resources is to run the Android emulator and use a Google APIs Emulator System targeting API level 25. You can also test your icons by installing your app on a Google Pixel device.

For more information about designing app launcher icons, see the Material Design guidelines.

https://developer.android.com/about/versions/nougat/android-7.1.html#circular-icons

It's possible to have different icons set for different components (ie Activity and Service). Make sure that you have the icon only defined for the application element, and nothing else. This will guarantee that all components will have a the same icon, the one defined in the application.

For some reason it was the ROM I had on my phone (it was a gingerbread MIUI ROM). I put a new ROM on my phone today and it works fine. Strange.

I had a similar problem. I am running a custom rom (Cyanogen mod 7), and my solution was to simply reboot my device. After that, the icon appeared.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM