Android Studio Error: Default Activity not found


⚠️ Error: Default Activity not found

If you are trying to run an Android Application on a Device or Emulator and you get the above error message (this can occur on both Android Studio and Eclipse IDE) then the most probable reason for this is the missing launcher activity in AndroidManifest.xml file.

Every Android Application must one application tag in the Manifest file and within it, there must be an Activity with <intent-filter> tag with action and category sub-tags. Whichever activity has these tags within it is the Launcher/Default activity which gets loaded when the App is run on a device.

Note you can have more than once activity with <intent-filter> tags in it, in such a scenario you would find App launcher icons when the App is installed on the device.

File : AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.code2care.tools.jsonwithandroid" >

    <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>

</manifest>

Note that the Activity tag should be inside the <application> </application> tag.

Android Studio Error - Default Activity not found
Android Studio Error - Default Activity not found
Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap