问题
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
回答1:
App>edit Configurations> On launch options choose Launch "Nothing"
回答2:
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..
回答3:
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
来源:https://stackoverflow.com/questions/49582803/error-default-activity-not-found-for-an-app-containing-a-broadcast-receiver