Getting an IllegalArgumentException when starting an activity with a bundle like this:
val intent = Intent(this, IntroActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
val bundle = ActivityOptionsCompat.makeCustomAnimation(this, R.anim.fade_in_activity, R.anim.fade_out_activity).toBundle()
startActivity(intent, bundle)
The main problem is that this doesn't occur on all devices. So far, from 100+ devices, got it on around 20 or so.
I'm getting the following stacktrace:
Fatal Exception: java.lang.IllegalArgumentException
at android.os.Parcel.readException(Parcel.java:1722)
at android.os.Parcel.readException(Parcel.java:1671)
at android.app.ActivityManagerProxy.isTopOfTask(ActivityManagerProxy.java:5573)
at android.app.Activity.isTopOfTask(Activity.java:6151)
at android.app.Activity.cancelInputsAndStartExitTransition(Activity.java:4440)
at android.app.Activity.startActivityForResult(Activity.java:4417)
at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:767)
at android.app.Activity.startActivity(Activity.java:4691)
at [...].splash.SplashActivity.continueToIntro(SplashActivity.java:428)
I saw a similar question here: rjava.lang.IllegalArgumentException on startActivity(intent,bundle animantion) But unfortunately I am already using ActivityOptionsCompat.
It's happening on Android api 23+.
Did anyone get this and did you manage to fix it?