Android App Development: Two icons getting created and I only need one

AndroidIcons

Android Problem Overview


I am writing an Android App that has one main activity and one subactivity. When I install the app on my phone to test it out, I get two icons instead of one. The first icon is for the main activity and the second is for the subactivity. I don't want/need an icon for the subactivity.

Does anyone know how to turn this off in my app code, so that only the icon for the main activity is installed? Any information you can provide is greatly appreciated!

Thanks, MobiKnow

Android Solutions


Solution 1 - Android

Does your application manifest list an intent filter under your sub-activity that matches the main launcher?

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

Make sure that your sub-activity is not filtering for these intents.

Edit: Just to be very clear, make sure the above lines are not listed under your sub-activity. That intent filter lets the Android system know that you intend for it to be listed as an entry point to your application.

Solution 2 - Android

We have the same problem but i fixed it this way before my code below in manifest

<application
        android:debuggable="true"
        android:allowBackup="true">
        <activity        android:name=".SplashActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.noupdate.apptest_noupdate.MainActivity"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

Notice that in the SplashActivity inside the intent is this code

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

i only deleted the category

 <category android:name="android.intent.category.LAUNCHER" />

So after i deleted the intent-filter category in splash it didn't install two app icon but only one for main the code will be like this notice that the intent-filter category is deleted

<application
        android:debuggable="true"
        android:allowBackup="true">
        <activity     android:name=".SplashActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

            </intent-filter>
        </activity>
        <activity
            android:name="com.noupdate.apptest_noupdate.MainActivity"
            android:icon="@drawable/ic_launcher"
            android:theme="@android:style/Theme.NoTitleBar"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

it really helps

Solution 3 - Android

>It creates two App icon because you must have added the given filter to two of your activities. See manifest.

<category android:name="android.intent.category.MAIN" />

Remove the above statement from the other one. Then you are good to go.

Solution 4 - Android

Like in the other answers,

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

Was the culprit. However, in my manifest I only had one activity with that intent filter. As it turns out, I am using a library I built and it has an activity declared in it's manifest which uses that intent filter. So, in short, be sure your app's manifest and dependencies, if any, only have one activity with the intent filter.

Solution 5 - Android

I guess that in your AndroidManifest.xml, you've got both activities having the LAUNCHER intent-filter. Remove it from the second activity, and you should be set!

Solution 6 - Android

You have

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

along with

android:icon="@drawable/icon.png"

set for both activities.

What that means is that this is a launcher icon, put me on the home screen. Only set those for the activit(ies/y) you want on the home screen.

Solution 7 - Android

I was searching answer to exactly the same question. It appears the only thing needed (in addition to recommendations on removing MAIN and LAUNCHER intent filter) is to rebuild your project - that will clean things up and upon next launch I saw single icon on my device (just running application on device after changes did not help).

Solution 8 - Android

if anyone run into this issue using Pebble SDK. I noticed PebbleKit Androidmanifest.xml holds a LAUNCHER activity as well. This is what caused it for me. Just remove this part. It will not effect Pebble functionality.

Solution 9 - Android

SIMPLE answer.. REMOVE:

<category android:name="android.intent.category.LAUNCHER" />

From your AndroidManifest.xml

Leave your intent-filter alone.

Solution 10 - Android

<intent-filter android:icon=”drawable resourceandroid:priority=”Integer” /intent-filter>

Priorities are set for the parent component. This setting may help you to set the parent icon for your Android app development.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMobiKnowView Question on Stackoverflow
Solution 1 - AndroidWorkerThreadView Answer on Stackoverflow
Solution 2 - AndroidCristiana ChavezView Answer on Stackoverflow
Solution 3 - AndroidXar-e-ahmer KhanView Answer on Stackoverflow
Solution 4 - AndroidTyler HView Answer on Stackoverflow
Solution 5 - AndroidBlumerView Answer on Stackoverflow
Solution 6 - AndroidFalmarriView Answer on Stackoverflow
Solution 7 - AndroidNeviQ-ORView Answer on Stackoverflow
Solution 8 - AndroidpseudozachView Answer on Stackoverflow
Solution 9 - AndroidFoxView Answer on Stackoverflow
Solution 10 - AndroidPon PandianView Answer on Stackoverflow