googlearchive / firebase-jobdispatcher-android

DEPRECATED please see the README.md below for details.
Apache License 2.0
1.79k stars 208 forks source link

NullPointerException in JobServiceConnection.startJob #288

Closed PaulMaxime closed 4 years ago

PaulMaxime commented 5 years ago

We are seeing a crash in startJob in JobServiceConnection. This doesn't happen all the time but we are seeing a lot of this crash in our Google Play Console.

java.lang.NullPointerException: at com.firebase.jobdispatcher.JobServiceConnection.startJob (JobServiceConnection.java:161) at com.firebase.jobdispatcher.ExecutionDelegator.executeJob (ExecutionDelegator.java:108) at com.firebase.jobdispatcher.GooglePlayMessageHandler.handleStartMessage (GooglePlayMessageHandler.java:98) at com.firebase.jobdispatcher.GooglePlayMessageHandler.handleMessage (GooglePlayMessageHandler.java:67) at android.os.Handler.dispatchMessage (Handler.java:106) at android.os.Looper.loop (Looper.java:193) at android.app.ActivityThread.main (ActivityThread.java:6718) 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)

We schedule our job like this:

// Use FirebaseJobDispatcher since it is backwards compatible until API 14.
val job = dispatcher.newJobBuilder()
  .setService(MyJobService::class.java)
  .setTag(RECURRING_TAG)
  .setRecurring(true)
  .setLifetime(Lifetime.FOREVER)
  // This will cause the job to not execute until the min elapsed time has passed,
  // but does not guarantee the job to be executed before the max time.
  .setTrigger(Trigger.executionWindow(intervalMinimum, intervalMaximum))
  // Make sure to update the scheduling constraints, in case server settings have changed.
  .setReplaceCurrent(true)
  .setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL)
  .setConstraints(Constraint.ON_ANY_NETWORK)
  .build()

dispatcher.mustSchedule(job)
DenysYakubets commented 5 years ago

I get the same exception. Any ideas?

samtstern commented 4 years ago

In April 2019 we announced that Firebase Job Dispatcher would be deprecated today, April 7th 2020. For this reason we are going to close all open issues and archive the repository. We will also stop supporting FJD for new app installations (such as those targeting sdk versions greater than Android Q). Existing apps that rely on FJD should continue to function as usual.

While we will no longer work on FJD, we encourage you to migrate to Work Manager which is a superior tool and fully supported by the Android team.

Thank you for taking the time to try the library and provide this feedback. We sincerely appreciate your effort and we apologize for not addressing it in time.