Search code examples
android-studioandroid-activityandroid-emulatorandroid-build

What happened to my Default Activity?


after the recent update, my application will not run. This is what happens whenever I run the app:

14:42   Gradle sync started

14:42   Project setup started

14:42   Gradle sync finished in 2s 996ms (from cached state)

14:42   Error running 'app': Default Activity not found

I tried most of the known methods and searched online which did not help. I have even invalidated the caches to see if there were any indexing issues. Some of the files I deleted were restored to see if that may have caused the problem but it did not.

This is the current state of my manifest:

    <uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

<meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="AIzaSyC60Yz2nx7GlbBMJqm69j_dZCuV_ULUIB0"/>

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

    <activity android:name=".MapActivity"/>

</application>

Please leave your suggestions below. Your help is appreciated!


Solution

  • Change your tag for this one:

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