Search code examples
javaandroidandroid-studioandroid-broadcastreceiver

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


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

Solution

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