Search code examples
xmlandroid-activityandroid-manifest

MainActivity is not declared in the manifest?


Ok, yesterday I made some changes and since then my app says that the MainActivity was not declared. At first, it said just "Default Activity not found" which, after trying a few decisions turned into "MainActivity is not declared.."

This is my code:

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.myapplication">
    <uses-permission android:name="android.permission.INTERNET"/>

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

Solution

  • Please Check your MainActivity is present in com.example.myapplication package

    Package in manifest and package of Actvities will be same.