gpt4 book ai didi

android - 安全异常 : Caller no longer running

转载 作者:可可西里 更新时间:2023-11-01 18:47:58 29 4
gpt4 key购买 nike

我在 Android O 及更高版本中尝试运行我的 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)

最佳答案

让您的 jobIntentService 扩展 MyJobIntentService

这将处理去往 remoteProcess 的多个 dequeueWork 调用,即使 remoteProcess 抛出安全异常以将已删除的工作弹出堆栈

package android.support.v4.app;

import timber.log.Timber;

public abstract class MyJobIntentService extends JobIntentService {

@Override

GenericWorkItem dequeueWork() {
try {
return super.dequeueWork();
} catch (SecurityException ignored) {
Timber.e(ignored);
}
return null;
}
}

注意:创建包“android.support.v4.app”很重要由于 GenericWorkItem 类位于此包内以获取访问权限。

关于android - 安全异常 : Caller no longer running,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50333475/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com