Android Application creating two launcher icons
Asked Answered
J

5

7

I am having a very confusing problem with an application I have been working on for some time. Suddenly, when running my application, I found an immediate force close upon launch.

Upon further investigation, I found two launcher icons in my launcher. One of which will either resume the application if it is running or force close if it is not running. The second will behave as normal - launches the application normally and resumes normally.

I am very confused, as I was not doing anything (that I can think of) to cause this problem. I was not changing anything whatsoever in the manifest and just implementing a few new methods to change colors in my app faster.

These problems persist identically in all my emulators and devices whether I turn off the phone, manually kill the app or uninstall/reinstall the app. A simple ctrl+z did not work. To clarify - all I would like is to go back to have one launcher icon to launch my application normally (nothing special goes on at all).

Update:

I am now presented with an immediate force close on launching from either icon. I did find code within two activities within my Manifest displaying and changing the second line from .LAUNCHER to .DEFAULT did fix my original problem. However, I am now always presented with an immediate force close...there are now problems (that I can see) within my originally launcher activity...I am having a lot of trouble attempting to fix this (have no idea what to do) and am starting to become VERY worried!

Update 2:

I found my problems and I thank you guys for all your help! I actually had two separate and unrelated problems that occurred at the same time. Number one - two icons in my launcher: caused because I had two activities with a

Jessicajessie answered 2/1, 2012 at 6:12 Comment(0)
G
24

two activities have

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

remove second one

Godless answered 2/1, 2012 at 6:14 Comment(2)
I did find that within my Manifest, and removing it did delete the second launcher icon. However, I am now always presented with an immediate force close...Jessicajessie
Update: I am now presented with an immediate force close on launching from either icon. I did find your referenced code within two activities within my Manifest, and changing the second line from .LAUNCHER to .DEFAULT did fix my original problem. However, I am still always presented with an immediate force close...I am having a lot of trouble attempting to fix this (have no idea what to do) and am starting to become VERY worried!Jessicajessie
P
3

Actually Android Launcher displays all activities with category LAUNCHER not applications.

If your application contains more than 1 activity, you have to use action MAIN and category LAUNCHER for your default activity (initial screen) of application only, not for all activities you used in application. If you put same for every activity in application it will be displayed in Android Launcher.

Please read about the Intent Actions and Categories, you will understood.

Piacular answered 2/1, 2012 at 6:43 Comment(0)
I
2

Well , I was facing same problem. Problem was when I RUN app, it was creating two icons one with name MyApp and other with SplashActivity. When I was attempting to uninstall SplashActivity (named app), in Confirmation message it was saying

SplashActivity is part of MyApp , sure you want to uninstall?

After looking at some references, concluded that when we put

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

under any activity, android thinks that this is the MAIN entry point of App. And creates an launcher icon for that activity. but name was kept as acivityName.

So Finally by changing Activity tag of SplashActivity from

 <activity
    android:name=".activities.SplashActivity"
    android:label="@string/title_activity_splash"
    android:theme="@style/SplashTheme">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
 </activity>

to

<activity
    android:name=".activities.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>

It solved my issue of multiple icons and launcher icon name as activityName instead of appName.

Ingraham answered 13/9, 2014 at 7:20 Comment(0)
M
0

In my case, helped somethning like that

The old one lines from the manifest file

Splash screen activity

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

Main Activity

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

And the new one

Splash screen activity

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

Main Activity

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

Just remove in Main Activity this line below

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

And that's it !

Mechelle answered 2/1, 2015 at 16:47 Comment(0)
C
0

in AndroidMenifest.xml file you have to remove two or three android name i.e

<activity
    android:name=".SplashScreen"
    android:label="@string/app_name" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
Cornice answered 10/3, 2016 at 9:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.