Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Android Studio says it could not identify the launch activity when you press Run

ErrorCould not identify launch Activity: Default Activity not found

Short answer

Android Studio launches the activity marked with a MAIN action and a LAUNCHER category in the merged manifest. If none is found, it cannot start the app. Check that the merged manifest has that intent filter, that the run configuration launch option is Default Activity, and that the activity name resolves to a real class.

  • Applies to Android Studio current stable, Android Gradle Plugin 8.x, Kotlin and Java apps
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Look at the merged manifest, not only your own file. In Android Studio open AndroidManifest.xml and click the Merged Manifest tab at the bottom.

    grep -rn "android.intent.category.LAUNCHER" app/src/*/AndroidManifest.xml
  2. 2Match what you see, then jump to its fix

    1. 1The search above prints nothing, or the Merged Manifest tab shows no launcher activityNo activity has the MAIN and LAUNCHER intent filterFix
    2. 2The manifest has a launcher activity but the error staysThe run configuration is set to launch nothing, or a missing activityFix
    3. 3The launcher filter exists, but the activity is listed with a wrong name in the Merged Manifest tabThe activity name does not match a class in your namespaceFix

What does the error look like?

  • Could not identify launch Activity: Default Activity not found
  • Run > Edit Configurations > Launch Options is set to Nothing or to a class that no longer exists

Cause 1 of 3

No activity has the MAIN and LAUNCHER intent filter

1Check

The Default Activity option launches the activity that is marked as startup in the manifest. If you moved the filter, deleted it, or put it in a build variant that is not selected, nothing is marked.

grep -rn -B4 -A4 "android.intent.action.MAIN" app/src/*/AndroidManifest.xml

2Fix

Add the filter to the activity that should start the app.

<activity android:name=".MainActivity" android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

3Verify

Press Run again. The app starts on the device.

./gradlew installDebug

Confirmed by developer.android.com

Did this fix it?

Cause 2 of 3

The run configuration is set to launch nothing, or a missing activity

1Check

In Run > Edit Configurations, look at the Launch Options. Nothing launches no activity. Specified Activity launches the class you typed, so a renamed class breaks it.

grep -n "MainActivity" app/src/main/AndroidManifest.xml

2Fix

Set Launch to Default Activity, or pick the right class under Specified Activity.

Run > Edit Configurations > app > General > Launch Options
Launch: Default Activity

3Verify

Press Run. Android Studio installs and starts the app.

adb shell am start -W -n com.example.app/.MainActivity

Confirmed by developer.android.com

Did this fix it?

Cause 3 of 3

The activity name does not match a class in your namespace

1Check

A name that starts with a period is added to the namespace from build.gradle. Anything else is read as a full class name.

grep -n "namespace" app/build.gradle*

2Fix

Correct android:name so the namespace plus the name, or the full name, is the real class.

<activity android:name=".MainActivity" ... />
<!-- or the full name -->
<activity android:name="com.example.app.MainActivity" ... />

3Verify

Sync and run again.

./gradlew assembleDebug

Confirmed by developer.android.com

Did this fix it?

How do I stop it coming back?

  • Open the Merged Manifest tab after you add libraries or build variants, so a missing launcher shows up before the first run.
  • Keep one launcher activity per app module.
  • Keep Launch Options on Default Activity unless you really need a specific screen.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.