如何处理这种异常?我在整个应用程序中使用唯一的工作ID时,Oreo中的给定工作不是活动异常。
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:353)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.IllegalArgumentException: Given work is not active: JobWorkItem{id=2 intent=Intent { cmp=com.virinchi.mychat/com.virinchi.receiver.AnalysticsSubmit } 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)
Run Code Online (Sandbox Code Playgroud)
public class AnalysticsSubmit extends JobIntentService {
private static String TAG = "AnalysticsSubmit";
/**
* Unique job ID for this service.
*/
/**
* Convenience method for enqueuing work in to this service. …Run Code Online (Sandbox Code Playgroud)