创建了两个发射器图标的示例应用程序。例如,两个 组件,如:
Create a sample application with two launcher icons. For example, two components such as:
<application ...>
<activity ... android:name="TestActivity01">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity ... android:name="TestActivity02">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
无论是通过从市场下载安装应用程序,或通过 AppInstaller。当消息对话框询问你,如果你想运行 应用程序,将抛出一个异常:
Either install the application via downloading from the Marketplace, or via AppInstaller. When the message box asks you if you would like to run the application, an exception is thrown:
02-03 16:42:44.270: ERROR/AndroidRuntime(395):
android.content.ActivityNotFoundException: Unable to find explicit activity
class {com.xxx.xxx/com.android.internal.app.ResolverActivity}; have you
declared this activity in your AndroidManifest.xml?
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1
480)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
android.app.Instrumentation.execStartActivity(Instrumentation.java:1454)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
android.app.Activity.startActivityForResult(Activity.java:2660)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
android.app.Activity.startActivity(Activity.java:2704)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
com.android.packageinstaller.InstallAppDone.onClick(InstallAppDone.java:105
)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
android.view.View.performClick(View.java:2344)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
android.view.View.onTouchEvent(View.java:4133)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
android.widget.TextView.onTouchEvent(TextView.java:6504)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
android.view.View.dispatchTouchEvent(View.java:3672)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEv
ent(PhoneWindow.java:1712)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneW
indow.java:1202)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
android.app.Activity.dispatchTouchEvent(Activity.java:1987)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(P
honeWindow.java:1696)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
android.view.ViewRoot.handleMessage(ViewRoot.java:1658)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
android.os.Handler.dispatchMessage(Handler.java:99)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
android.os.Looper.loop(Looper.java:123)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
android.app.ActivityThread.main(ActivityThread.java:4203)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
java.lang.reflect.Method.invokeNative(Native Method)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
java.lang.reflect.Method.invoke(Method.java:521)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:
791)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
02-03 16:42:44.270: ERROR/AndroidRuntime(395): at
dalvik.system.NativeStart.main(Native Method)
这次事故是因为 com.android.internal.app.ResolverActivity
是
试图找到一个(单)组件,它解决了以下意图:
The crash happens because com.android.internal.app.ResolverActivity
is
trying to find a (single) component which resolves the following intent:
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
请注意,这已被测试的两种与AppInstaller,和 一个真正的设备上的实际市场。
Please note that this has been tested BOTH with the AppInstaller, and the actual Marketplace on a real device.
从迈克的解决方法解决方案,为我工作:
The workaround solution from Mike worked for me:
请注意,该活动别名标签必须声明的在的活动标签,你指的是(N的XML)。
Note that the activity-alias tag must be declared after the activity tag you are referring to (n the xml).
看 HTTP://$c$c.google .COM / P /安卓/问题/详细信息?ID = 6579
注释2由Moussa.Mike,2010年3月30日
Comment 2 by Moussa.Mike, Mar 30, 2010
对于一个适当的解决办法将本次活动别名到你的清单:
For a proper workaround add this activity-alias to your manifest:
<activity-alias android:name="com.android.internal.app.ResolverActivity"
android:targetActivity=".Main" android:exported="true">
替换。主要
您.ClassName要启动为默认时,
打开按钮被击中在此一例
Replace .Main
with your .ClassName that you want to launch as the default when the
Open button is hit in this one case