Status Update
Comments
ch...@google.com <ch...@google.com> #2
hl...@gmail.com <hl...@gmail.com> #3
Artifact used androidx.work:work-runtime:2.3.1
Version used:2.3.1
Theme used:
Devices/Android versions reproduced on:
Pixel devices,One Plus devices / 10.0
Samsung, Realme, Oppo/ 9.0
Motorola / 8.0
- Relevant code to trigger the issue.
WorkManager workManagerInstance = WorkManager.getInstance(context);
Data input = new Data.Builder().putString("xxx", xxx).build();
Constraints constraints = new Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED).build();
mGetShowRequest = new OneTimeWorkRequest.Builder(ShowParserWork.class)
.setConstraints(constraints).setInputData(input)
.addTag(TAG_WORKER_NAME)
.setBackoffCriteria(BackoffPolicy.EXPONENTIAL, 30, TimeUnit.SECONDS).build();
workManagerInstance.enqueueUniqueWork(TAG_WORKER_NAME,
ExistingWorkPolicy.KEEP,mGetShowRequest);
Stacktrace:-
Fatal Exception: java.lang.IllegalStateException: JobScheduler 100 job limit exceeded. We count 101 WorkManager jobs in JobScheduler; we have 20 tracked jobs in our DB; our Configuration limit is 20.
at androidx.work.impl.background.systemjob.SystemJobScheduler.scheduleInternal + 199(SystemJobScheduler.java:199)
at androidx.work.impl.background.systemjob.SystemJobScheduler.schedule + 127(SystemJobScheduler.java:127)
at androidx.work.impl.Schedulers.schedule + 92(Schedulers.java:92)
at androidx.work.impl.WorkerWrapper.onWorkFinished + 369(WorkerWrapper.java:369)
at androidx.work.impl.WorkerWrapper$2.run + 318(WorkerWrapper.java:318)
at androidx.work.impl.utils.SerialExecutor$Task.run + 91(SerialExecutor.java:91)
at java.util.concurrent.ThreadPoolExecutor.runWorker + 1167(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run + 641(ThreadPoolExecutor.java:641)
at java.lang.Thread.run + 919(Thread.java:919)
Caused by java.lang.IllegalStateException: Apps may not schedule more than 100 distinct jobs
at android.os.Parcel.createException + 2079(Parcel.java:2079)
at android.os.Parcel.readException + 2039(Parcel.java:2039)
at android.os.Parcel.readException + 1987(Parcel.java:1987)
at android.app.job.IJobScheduler$Stub$Proxy.schedule + 308(IJobScheduler.java:308)
at android.app.JobSchedulerImpl.schedule + 43(JobSchedulerImpl.java:43)
at androidx.work.impl.background.systemjob.SystemJobScheduler.scheduleInternal + 181(SystemJobScheduler.java:181)
at androidx.work.impl.background.systemjob.SystemJobScheduler.schedule + 127(SystemJobScheduler.java:127)
at androidx.work.impl.Schedulers.schedule + 92(Schedulers.java:92)
at androidx.work.impl.WorkerWrapper.onWorkFinished + 369(WorkerWrapper.java:369)
at androidx.work.impl.WorkerWrapper$2.run + 318(WorkerWrapper.java:318)
at androidx.work.impl.utils.SerialExecutor$Task.run + 91(SerialExecutor.java:91)
at java.util.concurrent.ThreadPoolExecutor.runWorker + 1167(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run + 641(ThreadPoolExecutor.java:641)
Caused by android.os.RemoteException: Remote stack trace:
at com.android.server.job.JobSchedulerService.scheduleAsPackage(JobSchedulerService.java:1038)
at com.android.server.job.JobSchedulerService$JobSchedulerStub.schedule(JobSchedulerService.java:2740)
at android.app.job.IJobScheduler$Stub.onTransact(IJobScheduler.java:153)
at android.os.Binder.execTransactInternal(Binder.java:1021)
at android.os.Binder.execTransact(Binder.java:994)
This issue has resurfaced only on our production builds, with multiple instances of crashes. Can you let us know a fix for this issue? Thanks
ch...@google.com <ch...@google.com> #4
We fixed a bug recently, where there is a mismatch between WorkManager
s tracking of jobs in JobScheduler
and the actual state of the jobs
. This happens in very rare cases, and I think that's what is going on in your case.
This change (WorkManager
2.3.2 very soon.
If you cannot wait, you can use a snapshot build that should be identical to the eventual release.
Here is the gradle snippet you will need:
repositories {
google()
maven { url 'https://ci.android.com/builds/submitted/6195753/androidx_snapshot/latest/repository/' }
}
dependencies {
implementation "androidx.work:work-runtime:2.4.0-SNAPSHOT"
}
One other thing you might need to do is to get rid of stale jobs. It is as simple as calling JobScheduler.cancelAllJobs()
before WorkManager is initialized. You can do it inside Application.onCreate()
in your Application subclass.
ry...@gmail.com <ry...@gmail.com> #5
jh...@berkeley.edu <jh...@berkeley.edu> #6
Failed to resolve: androidx.work:work-runtime:2.4.0-SNAPSHOT
<a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>
Affected Modules: <a href="openFile:D:/ Android App/app/build.gradle">app</a>
In my Application class, we have added WorkManager.getInstance(this).cancelAllWork();.Also, should I use the same work manager instance from my application class for all my work requests?
hl...@gmail.com <hl...@gmail.com> #7
Coming from stackoverflow here.
The build you mentioned doesn't seem to exist, and when I use the latest build (
I get some very weird missing library errors.
jc...@gmail.com <jc...@gmail.com> #8
My apologies for the delay. Try using this. This is from our dev branch.
repositories {
google()
maven { url 'https://ci.android.com/builds/submitted/6215972/androidx_snapshot/latest/repository/' }
}
dependencies {
implementation "androidx.work:work-runtime:2.4.0-SNAPSHOT"
}
Description
First, please search through existing issues to ensure that the feature request has not already been reported. You can start the search here:
If the feature has already been requested, you can click the star next to the issue number to subscribe and receive updates. We prioritize responding to the issues with the most stars. You can also comment on the issue to provide any context of how the feature would benefit you.
Also, please verify that the functionality you are requesting is not already present in the current API and tools.
If your feature has not been requested, please provide all of the following:
-----------------------------------------------------------------------------------------------------------------------------
A short description of the request:
What is the purpose of this new feature?
What existing APIs would this affect?
What existing data does this use?
Please provide any additional information below.
1. An API for Gmail smart-compose feature
2. This API will be useful for people to use in their own projects.
3. According to me, gmail-api will be affected
4. I am not sure what existing data will it use.