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

后端 未结 10 2193
情书的邮戳
情书的邮戳 2020-12-14 00:14

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 ic

相关标签:
10条回答
  • 2020-12-14 00:39

    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.

    0 讨论(0)
  • 2020-12-14 00:39

    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).

    0 讨论(0)
  • 2020-12-14 00:40

    SIMPLE answer.. REMOVE:

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

    From your AndroidManifest.xml

    Leave your intent-filter alone.

    0 讨论(0)
  • 2020-12-14 00:42

    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.

    0 讨论(0)
  • 2020-12-14 00:45

    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.

    0 讨论(0)
  • 2020-12-14 00:49

    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.

    0 讨论(0)
提交回复
热议问题