How to Fix Duplicate Application Icons in Android Development
As some of you know, I have been working on making a couple of Android applications for a couple of side projects.
I finally got to a point where I felt they were ready for release, so as you naturally would, I got a few friends to download the apk and give it a try. One big issue stood out though, when they installed the app, it was showing twice in their all apps list!
If you deleted one, it deleted both from the phone but either one would load the application up perfectly fine. After much deliberation and many head scratching moments I finally found out what caused the issue, in the AndroidManifest.xml it was the fact that I added a splash screen to the application which meant I declared the Splash Screen’s activity as LAUNCHER but I already had a LAUNCHER declared, the main activity class! Below is what my Manifest looked like:
<activity android:name=".SplashActivity" android:label="@string/app_name" android:theme="@style/SplashTheme"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".MainActivity" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
All that I needed to do to fix the issue was delete the second LAUNCHER statement inside the MainActivity <activity> tag and it was working a treat!