Default Activity not found in Android Studio Default Activity not found in Android Studio android android

Default Activity not found in Android Studio


Have you added ACTION_MAIN intent filter to your main activity? If you don't add this, then android won't know which activity to launch as the main activity.

ex:

<intent-filter>      <action android:name="android.intent.action.MAIN"/>      <action android:name="com.package.name.MyActivity"/>      <category android:name="android.intent.category.LAUNCHER" /></intent-filter>


In Android Studio, right click on the project and choose Open Module Settings. Then go to the Sources tab in your module, find the src folder, right click on it and mark it as Sources (blue color).

EDIT: There is no sources tab in later versions of Android Studio, but you can edit the build.gradle file instead: https://stackoverflow.com/a/22028681/1101730 (thanks for comment Josh)


I had the same problem while importing a project into Android Studio, probably caused by the fact that the project has been developed on an earlier version of Android Studio than currently installed on my computer.

What solved it was simply choosing:

File -> Invalidate Caches / Restart...

and then selecting Invalidate and Restart.