[go: up one dir, main page]

Application Crashes in Android Auto on First Run

Whenever running the application for the first time, there is not a most recent sermon in the phone's database. The implementation in the PlayerViewModel triggers an error from RxJava's onError() method. However, the usage of this implementation in SermonService.restoreFromLastSession() does not subscribe to onError(). Therefore, RxJava throws a fatal error.

The implementation needs to listen to both the onSuccess() and the onError() cases, even though nothing needs to happen in either case.

Steps to Reproduce:

  1. Install a fresh version of the app
  2. Download at least one sermon and grant the Branham Player storage permissions
  3. Open the app in Android Auto and observe that it reports problems

Stack trace:

2018-09-13 16:38:40.300 6465-6465/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: tech.oliver.branhamplayer.android, PID: 6465
io.reactivex.exceptions.OnErrorNotImplementedException: Could not find a most recent sermon
    at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:704)
    at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:701)
    at io.reactivex.internal.observers.ConsumerSingleObserver.onError(ConsumerSingleObserver.java:47)
    at io.reactivex.internal.operators.single.SingleObserveOn$ObserveOnSingleObserver.run(SingleObserveOn.java:79)
    at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:109)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6669)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
 Caused by: java.lang.Throwable: Could not find a most recent sermon
    at tech.oliver.branhamplayer.android.sermons.viewmodels.PlayerViewModel$getMostRecentSermonAsync$1$subscription$3.run(PlayerViewModel.kt:38)
    at io.reactivex.internal.operators.maybe.MaybeCallbackObserver.onComplete(MaybeCallbackObserver.java:94)
    at io.reactivex.internal.operators.maybe.MaybeObserveOn$ObserveOnMaybeObserver.run(MaybeObserveOn.java:106)
    at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:109) 
    at android.os.Handler.handleCallback(Handler.java:873) 
    at android.os.Handler.dispatchMessage(Handler.java:99) 
    at android.os.Looper.loop(Looper.java:193) 
    at android.app.ActivityThread.main(ActivityThread.java:6669) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
Edited by Oliver Spryn