The application is installed and has two icons

I made an Android app and worked very well, but there are two icons on my device screen. I think this could be an AndroidManifest problem. Any idea what this could be?

This is my AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="pk.aeh.ideos.taa" android:versionCode="1" android:versionName="1.0" > <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar" > <activity android:name=".Ghinho_congviecActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="Nhap_congviecActivity"></activity> <activity android:name="Sua_congviecActivity"></activity> <activity android:name=".Quizzes" android:launchMode="singleTask"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".PlayGame" /> <activity android:name=".Result" /> </application> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 

+4
source share
7 answers

You need to make these changes to your Manifest.xml

 <activity android:name=".Ghinho_congviecActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="Nhap_congviecActivity"></activity> <activity android:name="Sua_congviecActivity"></activity> <activity android:name=".Quizzes" android:launchMode="singleTask"> </activity> 

I assume that Activity with the android:label="@string/app_name" attribute may be your main activity.

+2
source

It. You have two of them:

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

Get rid of the one you don't need.

+4
source

This may be due to the fact that you declared two actions as MAIN and LAUNCHER

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

in your Androidmanifest.xml file. You only need to have one action with these intent filters, so when the application is installed, the system will know which activity should be used as the main launch activity.

+4
source

Perhaps this is due to the fact that you changed the name of your package and installed it twice with different package names.

0
source

Delete the intent filter of one of the activities and it will work perfectly.!

0
source

There should only be one action in your manifest file with the below Intent Filter, Activity, for which you want to have an icon:

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

Based on your description, it sounds like two activities have this line. Check your manifest ...

0
source

You can only declare one Intent filter in activity on AndroidManifest.

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

If you used two or more intent filters in AndroidManifest, then you will have an application icon 2, so remove it and set one intent filter.

I believe this is useful to you.

0
source

Source: https://habr.com/ru/post/1444999/


All Articles