Fix missing indicator icon on Ubuntu 18.04 or 18.10 (Gnome Shell AppIndicator extension)

Ubuntu 18.10 and 18.04 use (K) StatusNotifierItem / AppIndicator support The default extension of Gnome Shell. For some users, an error may occur on Ubuntu 18.04 and 18.10, which causes the indicator icon in the top bar to be lost.
I ’m not sure what triggered the missing indicator icon error, but reloaded Gnome Shell (Alt + F2 Then type r) Displays the indicator icon. When running a new application using the indicator icon, it will not appear until the Gnome Shell is restarted again.
More importantly, if you lock the screen and then unlock it, the icon will be lost again until the Gnome Shell is reloaded.

The fix for this issue comes from nikosnikos users On GitHubAnd delete all indicator-* You may have installed packages on the system.
However, on my Ubuntu 18.10 system, I only need to delete two indicator packages to restore the indicator icon to my Gnome Shell desktop: indicator-application with indicator-common. To remove these two packages, use:

sudo apt remove indicator-application indicator-common

And restart.
If the indicator icon is still missing on your Gnome Shell desktop, you can try to delete all indicator-* The software package, as suggested by nikosnikos. However, this may also delete some other indicators that you might want to keep on the system, so make sure to be aware of the packages that are removed when using this command. Delete all indicator-* For software packages in Ubuntu, please use:

sudo apt remove indicator-*

And restart.
The indicator icon should now be available on Ubuntu 18.04 or 18.10 Gnome Shell desktops with (K) StatusNotifierItem / AppIndicator support extension.
Interestingly, I tried to reproduce the new Ubuntu installation error by installing the indicator package that is exactly the same as the indicator package installed on the host (indicator-application with indicator-common), And the error did not occur. Therefore, other factors must also be combined indicator-application (Maybe there are some other Unity indicator packages), this error will be triggered.