Error: 'Default Activity Not Found' for an app containing a Broadcast receiver
Asked Answered
M

3

0

I have two separate apps.

The first sends out two different kinds of Broadcasts.

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

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.

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:

  • As suggested by @Lemi Miles, We can simply go to App>edit Configurations> On launch options and choose Launch "Nothing".
  • Alternatively, you could create an activity with no functionality to act as a launcher activity for the app
Martamartaban answered 30/3, 2018 at 23:45 Comment(2)
simply define a default Activity and use this Activity as proxy for the other two.Spearwort
Post your manifest.Hahnke
S
4

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

Sydney answered 4/4, 2018 at 17:10 Comment(0)
H
0

I had this problem since 3 days.. If you are sure that there is no problem in your manifest.xml then Here is a solution... 1)Delete Android.3.1 or which version folder you have from c/User/Android.your version... 2)Then start Android again..

It worked for me..

Hofstetter answered 22/11, 2018 at 10:3 Comment(0)
W
0

I had the same problem. Try this: In Android Studio Tool Bar -> select Run->Edit Configuration-> On Launch Option ->Select Nothing in place of Default Activity

Wooded answered 5/12, 2018 at 16:6 Comment(1)
Hi, just a note for future contributions. This question already had an accepted answer. Your answer looks very similar to that one. Consider adding more value next time.Lyte

© 2022 - 2024 — McMap. All rights reserved.