问题描述
当我跑我的手机上的应用程序就被安装3次,不知道为什么它这样做,任何人都知道如何解决此问题?
When running my app on my phone it gets installed 3 times, not sure why it does this, anyone know how I can solve this?
我的清单
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<uses-library android:name="com.google.android.maps" />
<activity
android:name=".MyTravelManagerActivity"
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=".Main"
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=".OpenMap"
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>
推荐答案
该应用程序只安装一次。但是你看它在应用程序启动3次。在应用程序启动每个图标都对应于你的活动之一。它是由您为每个活动指定的意图过滤器造成的:
The app is installed only once. But you see it 3 times in the application launcher. Each icon in the application launcher corresponds to one of your activities. It is caused by the intent filter you specified for each of the activities:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
的意图过滤器说,活动可以启动,并与相应的标签的图标应该是在应用程序启动明显。如果preSS启动器中的图标,将启动相应的活动。通常情况下,你只有一次这样的活动在应用程序中。
The intent filter says that the activity can be launched and it's icon with a corresponding label should be visible in the application launcher. If you press the icon in the launcher, you will start the corresponding activity. Typically, you have only one such activity in the application.
BTW:在Android应用程序都在的AndroidManifest.xml
文件中指定的包区分开来。因此,除非你改变了包,你不能多次安装应用程序。
Btw: Apps on Android are distinguished by the package specified in AndroidManifest.xml
file. Therefore unless you change the package, you can't install the app multiple times.
这篇关于在Android设备上跑了一次Android应用程序被安装3次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!