1

我使用这个库(JobSchedulerCompat)来安排一些工作,但我在随机场合遇到了同样的错误。Logcat 看起来像这样:

08-21 15:56:30.232  11953-11953/com.mypackage.jobscheduleexample E/JobServiceCompat﹕ Application unable to handle onStopJob.
    java.lang.IllegalArgumentException: Service not registered: me.tatarka.support.internal.job.JobSchedulerService$JobServiceConnection@41905038
            at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:973)
            at android.app.ContextImpl.unbindService(ContextImpl.java:1671)
            at android.content.ContextWrapper.unbindService(ContextWrapper.java:536)
            at me.tatarka.support.internal.job.JobSchedulerService.finishJob(JobSchedulerService.java:212)
            at me.tatarka.support.internal.job.JobSchedulerService.access$000(JobSchedulerService.java:29)
            at me.tatarka.support.internal.job.JobSchedulerService$JobServiceConnection$1.acknowledgeStopMessage(JobSchedulerService.java:143)
            at me.tatarka.support.job.JobService$JobHandler.ackStopMessage(JobService.java:158)
            at me.tatarka.support.job.JobService$JobHandler.handleMessage(JobService.java:111)
            at android.os.Handler.dispatchMessage(Handler.java:106)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5196)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
            at dalvik.system.NativeStart.main(Native Method)
08-21 15:56:30.232  11953-11953/com.mypackage.jobscheduleexample E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.mypackage.jobscheduleexample, PID: 11953
    java.lang.RuntimeException: java.lang.IllegalArgumentException: Service not registered: me.tatarka.support.internal.job.JobSchedulerService$JobServiceConnection@41905038
            at me.tatarka.support.job.JobService$JobHandler.handleMessage(JobService.java:114)
            at android.os.Handler.dispatchMessage(Handler.java:106)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5196)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
            at dalvik.system.NativeStart.main(Native Method)

该服务在清单上注册,导出参数为 True。

OnStopJob 方法我只返回 false,没有别的。当我尝试通过执行以下操作从 Job Scheduler 取消所有作业时会发生这种情况:

mJobScheduler.cancelAll();

编辑:对不起,但我不知道如何在 Stackoverflow 中格式化 Logcat,如果你知道,请编辑我的问题。.

4

0 回答 0