I get the following crash on Firebase crashlytics and I have no idea what I can do to solve it.
It happens very rarely. The scenario is that I start an activity from a service while the app is in the background. Any thoughts?
It happens on Android 11 and I have been granted the draw overlay permission when it happens.
Android 11 introduced the need for apps to have the draw overlay permission to start activities from a service while they are in the background. I make sure that I have it so that is not the cause of the issue.
Fatal Exception: java.lang.NullPointerException
Attempt to read from field 'java.lang.String com.android.server.wm.Task.affinity' on a null object reference
Caused by android.os.RemoteException
Remote stack trace: at com.android.server.wm.ActivityStack.resumeTopActivityInnerLocked(ActivityStack.java:2092) at com.android.server.wm.ActivityStack.resumeTopActivityUncheckedLocked(ActivityStack.java:1710) at com.android.server.wm.RootWindowContainer.resumeFocusedStacksTopActivities(RootWindowContainer.java:2475) at com.android.server.wm.ActivityStarter.resumeTargetStackIfNeeded(ActivityStarter.java:3169) at com.android.server.wm.ActivityStarter.recycleTask(ActivityStarter.java:2521)