JobIntentService onComplete崩溃 [英] Getting crash on JobIntentService onComplete

查看:459
本文介绍了JobIntentService onComplete崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在获取Android 8的崩溃报告,但找不到原因或解决方法:

I am getting following crash reports for Android 8, but I could not find a reason or fix for this:

java.lang.IllegalArgumentException: Given work is not active: JobWorkItem{id=1 intent=Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x1000010 pkg=com.xxx.android cmp=com.xxx.android/com.pushio.manager.PushIOGCMIntentService (has extras) } dcount=1}
at android.app.job.JobParameters.completeWork(JobParameters.java:221)
       at android.support.v4.app.JobIntentService$JobServiceEngineImpl$WrapperWorkItem.complete(JobIntentService.java:267)
       at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:393)
       at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:382)
       at android.os.AsyncTask$2.call(AsyncTask.java:333)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)

我正在使用PushIO lib进行推送通知.

I am using PushIO lib for push notifications.

推荐答案

对我来说,当我有2个不同的JobIntentService都使用相同的JOB_ID(enqueueWork()

For me this happened when I had 2 different JobIntentService's which both used the same JOB_ID (last parameter of enqueueWork()

因此,该ID在整个应用中似乎必须是唯一的.

So it looks like this ID needs to be unique throughout your whole app.

是的,起初我认为它仅对于您使用它的类是唯一的,但这不是真的! 每个UID对于您的整个应用来说,它必须是唯一的.因此,如果您使用的库使用相同的ID,则需要将其更改为其他名称.不确定您应该如何知道已经使用了哪个ID.

Yes, at first I thought it needed to be unique just for the class you are using it for, but that is not true! It needs to be unique for your whole app, per UID. So if a library you use, uses the same ID, you need to change it to something else. Not sure how you should know which ID's are taken already.

另一件事是,您不能为同一类使用不同的ID.同一类的ID也必须相同,否则将忽略具有不同JOB ID的第二次呼叫

Another thing is, that you can not use different ID's for the same class. It also has to be the same ID for the same class, otherwise a second call with a different JOB ID will be ignored

这篇关于JobIntentService onComplete崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆