I managed to find my problem. Although I wasn’t setting
android:launchMode=”singleTask”
my LoginActivity had
android:noHistory=”true”
which results in that exception. I put noHistory true because I didn’t want the user to be able to press back button on the first activity after login and go back to login screen. Now I need to find another solution.