androidandroid-studioandroid-activitylauncherrun-app

installed application from Android Studio opens another activity instead of launcher activity


Whenever I run my app from Android studio, an Activity having

android:exported="true"

get's launched instead of launcher activity

<activity
        android:name=".activity.SplashScreen"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.AppCompat.NoActionBar"
        android:windowSoftInputMode="stateHidden|adjustPan">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

But once app installed, correct launcher activity opens, no issue. Only issue happens when I launch my app from Android studio(i.e. by running the app). So why this happens?

Without android:exported="true", on some devices, that activity not gets launched after clicking notification of my app. So is it good to keep exported true?

Also I can't post my entire manifest here


Solution

  • If it only happens in Android Studio and not when the app is installed, it is most likely a problem with the run configuration. You can access it by going to

    Run -> Edit Configurations