How to fix Default Activity Not Found in Android Studio

How to fix Default Activity Not Found in Android Studio

7,457

This error will cause when your app lose define of your main activity, mostly is because you removed part of your main activity code from AndroidManifest.xml file.

Here is a sample of how your main activity class should be defined in AndroidManifest.xml file.

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
 
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
</application>

If you cross check your AndroidManifest.xml  with sample code above most probably you will realize that there is shorter code in  <intent-filter> section both action and category tags are required to define main activity.


- Last updated 3 years ago

Be the first to leave a comment.

You must login to leave a comment