Fixed
Status Update
Comments
au...@google.com <au...@google.com> #2
Bringing setMaxSchedulerLimit to say 49 doesn't help. Same error.
da...@google.com <da...@google.com> #3
If you are using work-firebase then you should not be using JobScheduler directly. Can you please send us the full bug report so we can investigate ?
au...@google.com <au...@google.com> #4
java.lang.IllegalStateException: Apps may not schedule more than 100 distinct jobs
at android.os.Parcel.readException(Parcel.java:1692)
at android.os.Parcel.readException(Parcel.java:1637)
at android.app.job.IJobScheduler$Stub$Proxy.schedule(IJobScheduler.java:158)
at android.app.JobSchedulerImpl.schedule(JobSchedulerImpl.java:42)
at androidx.work.impl.background.systemjob.SystemJobScheduler.scheduleInternal(SystemJobScheduler.java:126)
at androidx.work.impl.background.systemjob.SystemJobScheduler.schedule(SystemJobScheduler.java:95)
at androidx.work.impl.Schedulers.scheduleInternal(Schedulers.java:104)
at androidx.work.impl.Schedulers.schedule(Schedulers.java:73)
at androidx.work.impl.WorkerWrapper.setSucceededAndNotify(WorkerWrapper.java:393)
at androidx.work.impl.WorkerWrapper.handleResult(WorkerWrapper.java:255)
at androidx.work.impl.WorkerWrapper.run(WorkerWrapper.java:181)
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:761)
at android.os.Parcel.readException(Parcel.java:1692)
at android.os.Parcel.readException(Parcel.java:1637)
at android.app.job.IJobScheduler$Stub$Proxy.schedule(IJobScheduler.java:158)
at android.app.JobSchedulerImpl.schedule(JobSchedulerImpl.java:42)
at androidx.work.impl.background.systemjob.SystemJobScheduler.scheduleInternal(SystemJobScheduler.java:126)
at androidx.work.impl.background.systemjob.SystemJobScheduler.schedule(SystemJobScheduler.java:95)
at androidx.work.impl.Schedulers.scheduleInternal(Schedulers.java:104)
at androidx.work.impl.Schedulers.schedule(Schedulers.java:73)
at androidx.work.impl.WorkerWrapper.setSucceededAndNotify(WorkerWrapper.java:393)
at androidx.work.impl.WorkerWrapper.handleResult(WorkerWrapper.java:255)
at androidx.work.impl.WorkerWrapper.run(WorkerWrapper.java:181)
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:761)
da...@google.com <da...@google.com> #5
What do you mean I shouldn't use JobScheduler directly? Isn't work-firebase is just for <21 devices, otherwise JobScheduler always used?
da...@google.com <da...@google.com> #6
I think i was confused by your previous comment. You are right, we only use work-firebase for API < 23.
JobScheduler is used for API >= 23.
This issue should have been resolved in `alpha03` and `alpha04` (we addressed different parts of the problem). If you can reproduce this on a device, then can you do:
1. adb shell dumpsys jobscheduler for your app.
2. Reboot your device.
3. After the reboot, can you re-run adb shell dumpsys jobscheduler ?
I want to check if you see any differences in the jobs created before and after the reboot.
Thanks for your patience.
JobScheduler is used for API >= 23.
This issue should have been resolved in `alpha03` and `alpha04` (we addressed different parts of the problem). If you can reproduce this on a device, then can you do:
1. adb shell dumpsys jobscheduler for your app.
2. Reboot your device.
3. After the reboot, can you re-run adb shell dumpsys jobscheduler ?
I want to check if you see any differences in the jobs created before and after the reboot.
Thanks for your patience.
hm...@google.com <hm...@google.com> #7
Actually for step 2, the easier thing to do is to force stop your app. You don't need to fo a full reboot.
hm...@google.com <hm...@google.com> #8
I don't have to to rummage through traces. Here's code snippet that sends app into a crash loop. https://pastebin.com/NcTAnwjZ
hm...@google.com <hm...@google.com> #9
I tried to reproduce this on alpha04. However, I cannot reproduce your issue.
For reference, this is what my activity looks like:
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
findViewById<Button>(R.id.scheduler_limits_testcase1).setOnClickListener {
for (i in 1..100) {
val a1 = newWorkRequest("--- A1 ---")
val b1 = newWorkRequest("--- B1 ---")
val b2 = newWorkRequest("--- B2 ---")
val c1 = newWorkRequest("--- C1 ---")
WorkManager.getInstance()!!
.beginWith(a1).then(b1).enqueue()
WorkManager.getInstance()!!
.beginWith(a1).then(b2).enqueue()
WorkManager.getInstance()!!
.beginWith(b1, b2).then(c1).enqueue()
}
}
}
companion object {
private fun newWorkRequest(message: String): OneTimeWorkRequest {
val data = mapOf(TestWorker.KEY_MESSAGE to message).toWorkData()
return OneTimeWorkRequestBuilder<TestWorker>()
.setInputData(data)
.build()
}
}
}
This is what my Worker looks like:
class TestWorker : Worker() {
companion object {
private const val TAG = "TestWorker"
private const val MESSAGE_DEFAULT = "Default"
const val KEY_MESSAGE = "KEY_MESSAGE"
}
override fun doWork(): Result {
val message = inputData.getString(KEY_MESSAGE, MESSAGE_DEFAULT)
val random = Random()
val time = 500L + random.nextInt(300)
Log.d(TAG, "Before. $message")
Thread.sleep(time)
Log.d(TAG, "After. $message")
return Result.SUCCESS
}
}
For reference, this is what my activity looks like:
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
findViewById<Button>(R.id.scheduler_limits_testcase1).setOnClickListener {
for (i in 1..100) {
val a1 = newWorkRequest("--- A1 ---")
val b1 = newWorkRequest("--- B1 ---")
val b2 = newWorkRequest("--- B2 ---")
val c1 = newWorkRequest("--- C1 ---")
WorkManager.getInstance()!!
.beginWith(a1).then(b1).enqueue()
WorkManager.getInstance()!!
.beginWith(a1).then(b2).enqueue()
WorkManager.getInstance()!!
.beginWith(b1, b2).then(c1).enqueue()
}
}
}
companion object {
private fun newWorkRequest(message: String): OneTimeWorkRequest {
val data = mapOf(TestWorker.KEY_MESSAGE to message).toWorkData()
return OneTimeWorkRequestBuilder<TestWorker>()
.setInputData(data)
.build()
}
}
}
This is what my Worker looks like:
class TestWorker : Worker() {
companion object {
private const val TAG = "TestWorker"
private const val MESSAGE_DEFAULT = "Default"
const val KEY_MESSAGE = "KEY_MESSAGE"
}
override fun doWork(): Result {
val message = inputData.getString(KEY_MESSAGE, MESSAGE_DEFAULT)
val random = Random()
val time = 500L + random.nextInt(300)
Log.d(TAG, "Before. $message")
Thread.sleep(time)
Log.d(TAG, "After. $message")
return Result.SUCCESS
}
}
da...@google.com <da...@google.com> #10
Do you have another part of your codebase that is scheduling jobs with JobScheduler?
da...@google.com <da...@google.com> #11
We have 1 job that schedules once on app start, that's it.
ow...@google.com <ow...@google.com>
hm...@google.com <hm...@google.com> #12
I created a sample app.
For some reason it rarely crashes on AVD Emulator(Api 27), but 100% crashes on Genymotion Api 26 and my Xiaomi Redmi 7.1.2
You can try both Activities.
For some reason it rarely crashes on AVD Emulator(Api 27), but 100% crashes on Genymotion Api 26 and my Xiaomi Redmi 7.1.2
You can try both Activities.
hm...@google.com <hm...@google.com> #13
Hi, I've tried numerous times and have been unable to get your example to exhibit this problem. Could you please update to alpha05 and reproduce it? If you can reliably reproduce this issue, could you please do so with verbose logging enabled in your Configuration object (introduced in alpha05) and send us a bugreport?
da...@google.com <da...@google.com>
au...@google.com <au...@google.com> #14
I will some time later when I have time
Description
Applying the newer AGP KMP plugin to androidx.sqlite breaks the Gradle metadata such that a JVM project depending on the artifact will attempt (and fail) to use the android artifact instead of the JVM one.
This was originally reported in SQLite KMP b/396148592
Here is a diff on the metadata, left is before AGP KMP is used (i.e. after reverting the changes in this CL ) and right is with AGP KMP applied: https://diff.googleplex.com/#key=EY2FqaJWQbUQ
Let me know if you need a sample project, but if you create a new JVM or Kotlin project and depend on
androidx.sqlite:sqlite:2.5.0-beta01
and try to use classes from it, it will fail at runtime with a class not found exception. When inspecting the deps via:dependencies
you will notice it attempts to use the-android
artifact instead of the-jvm
one: