One more reason for this crash is described here:
// Check to see if the service had been started as foreground, but being
// brought down before actually showing a notification. That is not allowed.
So make sure that you don't stop your foreground service immediately right after starting it.