在Google控制台中,我在多个设备上看到以下例外情况,因为我无法理解我正在制作的错误。 有时我会收到IllegalArgumentException,有时会收到IllegalStateException
在模拟器中我没有这个例外,所以我无法重现它!
这是一个例外:
java.lang.RuntimeException:
at android.os.AsyncTask$3.done(AsyncTask.java:318)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:762)
Caused by: java.lang.IllegalStateException:
at android.os.Parcel.readException(Parcel.java:1701)
at android.os.Parcel.readException(Parcel.java:1646)
at android.app.job.IJobScheduler$Stub$Proxy.schedule(IJobScheduler.java:158)
at android.app.JobSchedulerImpl.schedule(JobSchedulerImpl.java:42)
at do.that.Worker$1.doInBackground(Worker.java:907)
at android.os.AsyncTask$2.call(AsyncTask.java:304)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
这是代码片段。我想提一下,我在AsyncTask中安排了Job。
ComponentName serviceComponent = new ComponentName(context, RetryJobSchedulerService.class);
JobInfo.Builder builder = new JobInfo.Builder(kJobId++, serviceComponent);
builder.setMinimumLatency(5 * 1000);
builder.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY);
JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
int result = jobScheduler.schedule(builder.build());
我设置了服务的权限:
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="true"
错误是什么?