After updating to API 27 and Support library 27.0.2 suddenly I get a lot of these stack traces in Crashlytics:
Fatal Exception: java.lang.IllegalArgumentException
at android.os.Parcel.readException(Parcel.java:1544)
at android.os.Parcel.readException(Parcel.java:1493)
at android.app.ActivityManagerProxy.isTopOfTask(ActivityManagerNative.java:5108)
at android.app.Activity.isTopOfTask(Activity.java:5688)
at android.app.Activity.startActivityForResult(Activity.java:3973)
at android.support.v4.app.BaseFragmentActivityApi16.startActivityForResult(Source:54)
at android.support.v4.app.FragmentActivity.startActivityForResult(Source:67)
I call this like:
ActivityOptions options = ActivityOptions.makeCustomAnimation(activity, R.anim.slide_in_from_right, R.anim.fade_out);
startActivityForResult( intent, REQ_ACTION, options.toBundle());
I cannot read the source code as it is not released yet. I even tried to replace and use android-26 code, but it's different.
There is a warning for the above call saying that BaseFragmentActivityApi16.startActivityForResult can only called from the same library group, so I fixed it by using ActivityCompat, but I don't think it will solve the crash problem.
Is this a platform issue or can I fix this?
Edit
if (Build.VERSION.SDK_INT >= 21) {
ActivityOptions options = ActivityOptions.makeCustomAnimation(activity, R.anim.slide_in_from_right, R.anim.fade_out);
startActivityForResult(intent, REQ_ACTION, options.toBundle());
} else {
ActivityOptions options = ActivityOptions.makeCustomAnimation(activity, R.anim.slide_in_from_right, R.anim.fade_out);
ActivityCompat.startActivityForResult(this, intent, REQ_ACTION, options.toBundle());
}
If I change it to the above according to the link in my comment, Android Studio complaining like above. This might be related to the problem.