"Default Activity Not Found" on Android Studio upgrade

Solution 1:

If you see that error occur after upgrading versions of IntelliJ IDEA or Android Studio, or after Generating a new APK, you may need to refresh the IDE's cache.

File -> Invalidate Caches / Restart...

Solution 2:

I can't comment on why the upgrade of IntelliJ might cause this problem because I don't use it.

However, that error: "Default Activity Not Found" seems to be telling you that you don't have an activity declared in AndroidManifest.xml that is marked as the main activity, to be launched when the application starts.

You should have at least one activity that looks something like this:

<activity
        android:name="com.your.package.name.YourActivity"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
</activity>

If you don't have at least one activity with an intent filter like that, you would most likely see the error message you have included here.

You should add that intent filter to the Activity that you wish to open when you start the application, and that should fix your problem.

Edit:

Additional details (AndroidStudio4.1.2) if the project is created as EmptyApplication then the developer must manually create below 3 files to avoid Default Activity Not Found error

AndroidManifest.xml enter image description here MainActivity.java enter image description here activity_main.xml enter image description here

Solution 3:

You app have launch activity default?

possibly this could be your mistake

enter image description here

Step 1: Select Edit Configurations

enter image description here

Step 2: watch this warning: Default Activity not found enter image description here

Step 3: select a default activity enter image description here

enter image description here

Step 3: Save your changes and finish

enter image description here

Good Luck

enter image description here

Solution 4:

If you are working on a widget app this solution should work for you:

  1. Go to Edit Configuration
  2. Set Launch Option to nothing

Solution 5:

The correct way to do this is to add the following to the Manifest file:

<activity
    android:name="FULL_NAME_OF_YOUR_ACTIVITY"
    android:label="@string/app_name" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

This should be inserted between:

<application> </application>

No need in invalidating caches.