Describe the bug
Kiwix crashes on launch.
Expected behavior
Kiwix not to crash.
Steps to reproduce the behavior:
Environment
Logs
E/AndroidRuntime: FATAL EXCEPTION: RxCachedThreadScheduler-3
Process: org.kiwix.kiwixcustomcustomexample, PID: 15598
kotlin.KotlinNullPointerException
at org.kiwix.kiwixmobile.core.main.MainPresenter.loadBooks(MainPresenter.kt:39)
at org.kiwix.kiwixmobile.core.main.MainPresenter$saveBooks$1.invoke(MainPresenter.kt:45)
at org.kiwix.kiwixmobile.core.main.MainPresenter$saveBooks$1.invoke(MainPresenter.kt:34)
at org.kiwix.kiwixmobile.core.main.MainPresenterKt$sam$io_reactivex_functions_Action$0.run(Unknown Source:6)
at io.reactivex.internal.observers.CallbackCompletableObserver.onComplete(CallbackCompletableObserver.java:53)
at io.reactivex.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.onComplete(CompletableSubscribeOn.java:79)
at io.reactivex.internal.operators.completable.CompletableFromAction.subscribeActual(CompletableFromAction.java:43)
at io.reactivex.Completable.subscribe(Completable.java:2302)
at io.reactivex.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.run(CompletableSubscribeOn.java:64)
at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:578)
at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
This crash goes away if I select the "app" build configuration instead of "custom".
The crash for "custom" is still a problem though. It should either be removed or the crash fixed.
The custom is a special kind of compilation and needs further resources to have a full working app. Look at https://github.com/kiwix/kiwix-android-custom. To me works as intended.
If it needs further resources and I forget to provide them, then we should make the Gradle build fail until they are provided. We know this at and we should be able to move this to compile time, so I should not be able to build an APK that we know will crash at runtime.
This error was introduced by the kotlin conversion, opening a PR