The case of disappearing launcher icons

From beautiful launcher icon to a vast space of emptiness

I’m writing this after observing this behavior again and again in multiple Android applications, including some of Google’s own applications. Their launcher icons just disappeared from my homescreen and this post explains why that happens.

Story time

We Android developers all know this feeling: You’re browsing through your Android applications project structure, look at all the modules, packages and files and realize something horrible:

MainActivity would fit so much better into this other package. It would be together with all the other Activities there and the project structure would make a lot more sense. 
It’s such an easy fix, just drag and drop MainActivity into that other package. Done. You feel so good about your change, you push it to master and a while later it’s getting released to the Play Store.

By releasing this minor change you just removed the launcher icon of your application from all your users homescreens. After installing the update of your application from the Play Store your users will stare at an empty space on their home screen instead of your beautiful (maybe even round) launcher icon, thinking about what application used to sit in that place.

Homescreen before updating the application (left) and after updating it (right). The Fingerprint icon is missing.

Why launcher icons disappear

By moving your launcher Activity to another package you will also change the launcher Intent of your application as it is defined in the AndroidManifest.xml. Android Studio even does this small change for you when dragging and dropping Activities around.

The definition of MainActivity in the AndroidManifest.xml

The icon disappears because the Launcher had previously associated the old package name of your MainActivity launcher Intent with your application. Now that the path of your MainActivity has changed the launcher cannot find it anymore.

The disappearing part of the launcher icon might be a bit different depending on which launcher is used but I myself have observed this in the Google Launcher, the Pixel Launcher and other 3rd party launchers. This is also very easy to miss during development because the app you’re working on gets uninstalled and installed a lot every day.

A small refactor can be a burden for the user

To get your application back onto the homescreen your users will now have to drag and drop the application icon back where they previously had it manually. Maybe they will forget about it. Maybe they will drag your competitors application into that empty spot.

Think about it: Those users that have your application on the homescreen are probably your power users. Those that rely on your app every single day. This small change can be a burden to those users. You might even lose some of them or see a decrease in your applications usage numbers because the application was removed from homescreens around the world. 
Out of sight, out of mind.

Think about your users

Try keeping your launcher Intent the same and think long and hard if you really have to change the path of the launcher Activity/Intent of your application. Of course there might be valid reasons of why it has to be done. But consider this case and think about your users when doing so.

tl;dr Keep your launcher Intent/Activity where it is, otherwise your launcher icon will disappear from homescreens around the world.

(Props to @diolor for teaching me this tidbid a while ago!)

As some people have pointed out in the comments here and on Twitter: Android supports something called activity-alias in your AndroidManifest.xml . It should enable you to still refactor the path of your launcher activity without making the launcher icon disappear. Read more about it here:
Thanks to everyone for pointing this out!