Fabio Collini
1 min readMar 19, 2019

--

Hi, is there a reason why you are using a SupervisorJob instead of a normal Job? Looking at the git log there is a recent commit to change it: https://android.googlesource.com/platform/frameworks/support/+/c504f932245cecf3de457ba06ec91ad3a81d0af7

Doing some tests the app crashes on an error inside a coroutine created using launch using both jobs (a SupervisorJob or a normal Job). The only difference that I have found is using async. Using a SupervisorJob the app doesn’t crash on an error but the error is lost (it’s not logged or managed). But I think that using async to launch a coroutine is not the right way (even Android Studio shows a warning using it without managing the returned Deferred).

Am I missing something? Why are you using a SupervisorJob? Do you suggest to always define a custom CoroutineExceptionHandler?

--

--

Fabio Collini

Android GDE || Android engineer @nytimes || author @androidavanzato || blogger @codingjam