我在AndroidO及以上版本中尝试运行JobIntentService时遇到以下问题,我很坚韧重现该问题:
Caused by java.lang.SecurityException: Caller no longer running, last stopped +206ms because: timed out while starting
at android.os.Parcel.readException(Parcel.java:1942)
at android.os.Parcel.readException(Parcel.java:1888)
at android.app.job.IJobCallback$Stub$Proxy.dequeueWork(IJobCallback.java:191)
at android.app.job.JobParameters.dequeueWork(JobParameters.java:196)
at android.support.v4.app.JobIntentService$JobServiceEngineImpl.dequeueWork(JobIntentService.java:314)
at android.support.v4.app.JobIntentService.dequeueWork(JobIntentService.java:639)
at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:389)
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)
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)
1条答案
按热度按时间m1m5dgzv1#
让您的jobIntentService扩展MyJobIntentService
这将处理去往remoteProcess的多个dequeueWork调用,即使remoteProcess抛出一个安全异常,将已经移除的工作弹出堆栈
注意:创建一个包“android.support.v4.app“是很重要的,因为GenericWorkItem类在这个包中以获得访问权。