I've been having this problem since upgrading to Android Studio 4.0 on macOS. When I try to start my app from Android Studio, I get the following error:
Could not identify launch activity: Default Activity not found
Error while Launching activity
What's a bit unique about my project is that the default activity is defined in the manifest of another library used by my project, not the project itself. This was all working fine before the upgrade, but now it isn't for me. When I open the project containing the dependency, it builds and runs fine. I've already tried the following steps:
You can solve the problem as follows:
Click your Module Selection window,then click Edit Configurations…
Then set Launch Options to Nothing; that's okay:
To dovetail off of Mike N.'s comment, it looks like it is an issue to be resolved in the next point release: https://issuetracker.google.com/issues/158019870
For the details of the quick fix, for me I looked at the Merged Manifest tab, which is at the bottom-left of the AndroidManifest.xml pane. This shows all of the library manifests combined with your activity's.
The dialog said an error occurred where browser:1.0.0 manifest had a minSdk of 15 whereas all the rest of my minSdk are 14. I clicked on:
use a compatible library with a minSdk of at most 14, or increase this project's minSdk version to at least 15.
Which brought up my minSdk to 15, and the error with the launcher went away, it will now insta-launch on my device. So I would sit tight for AS 4.0.1 but in the meantime, check the Merged Manifest.
For me this was happening in a project in which the main activity was declared in the manifest of an imported module (e.g. not in "app" module).
The solution for me was to add again the activity declaration in the manifest file of my top project:
<activity android:name="com.cristian_slav.elements.MainActivity"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With