错误:包含广播接收器的应用程序的“未找到默认活动" [英] Error: 'Default Activity Not Found' for an app containing a Broadcast receiver

查看:154
本文介绍了错误:包含广播接收器的应用程序的“未找到默认活动"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个单独的应用.

第一个发出两种不同的广播.

The first sends out two different kinds of Broadcasts.

第二个广播正在等待来自App#1的广播,并使用广播来决定要发起的活动.

The second one waits for this broadcast from App #1 and uses the broadcast to decide what activity to launch.

我对此感到困惑:在我看来,应用程序2(接收方应用程序)不一定需要默认活动,因为它启动的活动取决于从应用程序1接收的广播.

What I'm confused about is this: It seems to me that App #2 (the receiving app) shouldn't necessarily require a default activity since the activity it launches depends on the broadcast received from App #1.

但是,如果未在App#2中定义默认活动,则它将无法运行并引发:

But, if a default activity is not defined in App #2, it can't run and throws:

运行应用程序时出错:未找到默认活动

Error running app: Default activity not found

但是,如果我确实在清单文件中定义了一个,则这违背了广播的目的.

But, if I do define one in the manifest file, then this defeats the purpose of the Broadcast.

请帮助我了解全局,并提供解决方案.

Please help me understand the bigger picture and maybe offer a solution.

更新:问题已解决.对于面临相同问题的人们,我发现了两种可能的解决方法:

UPDATE: The issue is solved. To the people facing the same problem, I found 2 possible ways to resolve this:

  • 按照@Lemi Miles的建议,我们可以直接转到App> edit配置>启动选项,然后选择启动无".
  • 或者,您可以创建一个没有功能的活动充当该应用的启动器活动

推荐答案

App>编辑配置>在启动选项中,选择无"启动

App>edit Configurations> On launch options choose Launch "Nothing"

这篇关于错误:包含广播接收器的应用程序的“未找到默认活动"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆