Fixed
Status Update
Comments
fr...@gmail.com <fr...@gmail.com> #2
In SystemJobService, it can expect null, and able to tolerance null from WorkManagerImpl.getInstance, due to auto-backup reason.
@Override
public void onCreate() {
super.onCreate();
mWorkManagerImpl = WorkManagerImpl.getInstance(getApplicationContext());
if (mWorkManagerImpl == null) {
// This can occur if...
// 1. The app is performing an auto-backup. Prior to O, JobScheduler could erroneously
// try to send commands to JobService in this state ( b/32180780 ). Since neither
// Application#onCreate nor ContentProviders have run, WorkManager won't be
// initialized. In this case, we should ignore all JobScheduler commands and tell it
// to retry.
But, current WorkManagerImpl.getInstance(Context context) implementation is that, it will never return null but throw IllegalStateException.
Isn't there's conflict among these 2 SystemJobService.onCreate logic, and WorkManagerImpl.getInstance logic?
@Override
public void onCreate() {
super.onCreate();
mWorkManagerImpl = WorkManagerImpl.getInstance(getApplicationContext());
if (mWorkManagerImpl == null) {
// This can occur if...
// 1. The app is performing an auto-backup. Prior to O, JobScheduler could erroneously
// try to send commands to JobService in this state (
// Application#onCreate nor ContentProviders have run, WorkManager won't be
// initialized. In this case, we should ignore all JobScheduler commands and tell it
// to retry.
But, current WorkManagerImpl.getInstance(Context context) implementation is that, it will never return null but throw IllegalStateException.
Isn't there's conflict among these 2 SystemJobService.onCreate logic, and WorkManagerImpl.getInstance logic?
jo...@google.com <jo...@google.com>
fr...@gmail.com <fr...@gmail.com> #3
Project: platform/frameworks/support
Branch: androidx-master-dev
commit e14104eb7008f82edd50b37e16bd119b307e0554
Author: Sumir Kataria <sumir@google.com>
Date: Mon Jun 24 10:50:57 2019
Fix for JobScheduler calls when backup is in progress.
The original fix (ag/Ia1604b7c4b98f6b31869e1161a0c1efce7fe46f2) relied
on a null-check, but the new version of WorkManager.getInstance(Context)
with the Context param doesn't return null; it throws an Exception. This
CL updates the three places where we explicitly check for the return value
internally:
1. SystemJobService (the main place where this would manifest)
2. RescheduleReceiver
3. WorkManagerTestInitHelper (for consistency)
Fixes: 135858602
Test: Ran existing tests
Change-Id: Ia232869712d0c78fd80e91d0a863b8c50a080400
M work/workmanager-testing/src/main/java/androidx/work/testing/WorkManagerTestInitHelper.java
M work/workmanager/src/main/java/androidx/work/impl/background/systemalarm/RescheduleReceiver.java
M work/workmanager/src/main/java/androidx/work/impl/background/systemjob/SystemJobService.java
https://android-review.googlesource.com/988026
https://goto.google.com/android-sha1/e14104eb7008f82edd50b37e16bd119b307e0554
Branch: androidx-master-dev
commit e14104eb7008f82edd50b37e16bd119b307e0554
Author: Sumir Kataria <sumir@google.com>
Date: Mon Jun 24 10:50:57 2019
Fix for JobScheduler calls when backup is in progress.
The original fix (ag/Ia1604b7c4b98f6b31869e1161a0c1efce7fe46f2) relied
on a null-check, but the new version of WorkManager.getInstance(Context)
with the Context param doesn't return null; it throws an Exception. This
CL updates the three places where we explicitly check for the return value
internally:
1. SystemJobService (the main place where this would manifest)
2. RescheduleReceiver
3. WorkManagerTestInitHelper (for consistency)
Fixes: 135858602
Test: Ran existing tests
Change-Id: Ia232869712d0c78fd80e91d0a863b8c50a080400
M work/workmanager-testing/src/main/java/androidx/work/testing/WorkManagerTestInitHelper.java
M work/workmanager/src/main/java/androidx/work/impl/background/systemalarm/RescheduleReceiver.java
M work/workmanager/src/main/java/androidx/work/impl/background/systemjob/SystemJobService.java
ja...@google.com <ja...@google.com> #4
Thanks you so much for the speedy fixed!
May I know when will it be ready for production? As, currently, this IllegalStateException is impacting our users.
May I know when will it be ready for production? As, currently, this IllegalStateException is impacting our users.
fr...@gmail.com <fr...@gmail.com> #5
Hello, please look for this later in the week. If you want to work around this bug specifically and don't need on-demand initialization, you can use the old (deprecated) WorkManager.getInstance() method for now.
kr...@gmail.com <kr...@gmail.com> #6
Hello. Thanks for respond. I surely will keep a pair of eye on the next release :)
Yes. We don't need on-demand initialization. May I know how does using old (deprecated) WorkManager.getInstance() in our app code, able to bypass this problem? Isn't the crash is origin from library internal SystemJobService?
We once thinking to bypass this problem, by switching back to Version 2.0.1 (The version just before WorkManager.getInstance(Context) is introduced). However, we notice Room version is being changed in between. Downgrading WorkManager version, might cause additional SQLite problem.
Yes. We don't need on-demand initialization. May I know how does using old (deprecated) WorkManager.getInstance() in our app code, able to bypass this problem? Isn't the crash is origin from library internal SystemJobService?
We once thinking to bypass this problem, by switching back to Version 2.0.1 (The version just before WorkManager.getInstance(Context) is introduced). However, we notice Room version is being changed in between. Downgrading WorkManager version, might cause additional SQLite problem.
ja...@google.com <ja...@google.com> #7
Sorry, you are correct that moving to the deprecated method will not help you here. I would advise waiting for the release later this week. And thank you very much for finding this bug and doing the research to find the underlying issue.
I am curious: do you actually have reports of this bug on Android 9? It should've been fixed in the platform layer at that point. If possible, can you share any Android 9 specific logs/bugreports/stacktraces with device models?
I am curious: do you actually have reports of this bug on Android 9? It should've been fixed in the platform layer at that point. If possible, can you share any Android 9 specific logs/bugreports/stacktraces with device models?
jo...@google.com <jo...@google.com> #8
OK. Finger crossed users will not leave our app. I will follow the Green Dinosaur in Twitter, to wait for his announcement.
Based on your code comment, I thought this problem shouldn't occur in new Android but it happens some how. This is the log
Asus ZenFone 5 (ZE620KL) (ASUS_X00QD), Android 9 (Happen 2 times)
Asus ZenFone 5Z (ZS620KL/ZS621KL) (ASUS_Z01R_1), Android 9 (Happen 1 time)
3 incidents are having same log trace as below
java.lang.RuntimeException:
at android.app.ActivityThread.handleCreateService (ActivityThread.java:3570)
at android.app.ActivityThread.access$1300 (ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1672)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:198)
at android.app.ActivityThread.main (ActivityThread.java:6732)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)
Caused by: java.lang.IllegalStateException:
at androidx.work.impl.WorkManagerImpl.getInstance (WorkManagerImpl.java:142)
at androidx.work.impl.background.systemjob.SystemJobService.onCreate (SystemJobService.java:53)
at android.app.ActivityThread.handleCreateService (ActivityThread.java:3558)
at android.app.ActivityThread.access$1300 (ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1672)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:198)
at android.app.ActivityThread.main (ActivityThread.java:6732)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)
I attach the screenshot of Google Play Console as well. (I expect the stack trace should print programmer's message side-by-side with IllegalStateException. But it doesn't)
Feel free to let me know if you need any information from my side. Happy to help.
Based on your code comment, I thought this problem shouldn't occur in new Android but it happens some how. This is the log
Asus ZenFone 5 (ZE620KL) (ASUS_X00QD), Android 9 (Happen 2 times)
Asus ZenFone 5Z (ZS620KL/ZS621KL) (ASUS_Z01R_1), Android 9 (Happen 1 time)
3 incidents are having same log trace as below
java.lang.RuntimeException:
at android.app.ActivityThread.handleCreateService (ActivityThread.java:3570)
at android.app.ActivityThread.access$1300 (ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1672)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:198)
at android.app.ActivityThread.main (ActivityThread.java:6732)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)
Caused by: java.lang.IllegalStateException:
at androidx.work.impl.WorkManagerImpl.getInstance (WorkManagerImpl.java:142)
at androidx.work.impl.background.systemjob.SystemJobService.onCreate (SystemJobService.java:53)
at android.app.ActivityThread.handleCreateService (ActivityThread.java:3558)
at android.app.ActivityThread.access$1300 (ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1672)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:198)
at android.app.ActivityThread.main (ActivityThread.java:6732)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)
I attach the screenshot of Google Play Console as well. (I expect the stack trace should print programmer's message side-by-side with IllegalStateException. But it doesn't)
Feel free to let me know if you need any information from my side. Happy to help.
fr...@gmail.com <fr...@gmail.com> #9
Thanks, we'll investigate this internally.
jo...@google.com <jo...@google.com> #10
Hello, wondering whether the fix will be released in another one, or two days. As, users start to complain and leaving our app, due to increased crash rate :(
Thanks.
Thanks.
fr...@gmail.com <fr...@gmail.com> #11
Hi, we're still aiming to get this out this week.
jo...@google.com <jo...@google.com> #12
still have bug:
trace:
5 java.lang.IllegalStateException:WorkManager needs to be initialized via a ContentProvider#onCreate() or an Application#onCreate().
6 androidx.work.impl.background.systemjob.SystemJobService.onCreate(SystemJobService.java:68)
7 android.app.ActivityThread.handleCreateService(ActivityThread.java:3133)
8 android.app.ActivityThread.access$1900(ActivityThread.java:196)
9 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1622)
10 com.android.tony.defenselib.hook.HookHandle$1.handleMessage(HookHandle.java:30)
11 android.os.Handler.dispatchMessage(Handler.java:107)
12 android.os.Looper.loop(Looper.java:210)
13 android.app.ActivityThread.main(ActivityThread.java:5982)
14 java.lang.reflect.Method.invoke(Native Method)
15 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:852)
16 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)
this code cause crash:
if (!Application.class.equals(getApplication().getClass())) {
// During auto-backup, we don't get a custom Application subclass. This code path
// indicates we are either performing auto-backup or the user never used a custom
// Application class (or both).
throw new IllegalStateException("WorkManager needs to be initialized via a "
+ "ContentProvider#onCreate() or an Application#onCreate().");
}
my analysis:
code in handleCreateService() in ActivityThread.java:
" Application app = packageInfo.makeApplication(false, mInstrumentation);
service.attach(context, this,data.info.name , data.token, app, ActivityManager.getService())
"
handleCreateService--->. Application app = packageInfo.makeApplication(false, mInstrumentation); ---> forceDefaultAppClass is always false-->if have custom Application,will make custom Application ---> service.attach(context, this,data.info.name , data.token, app, ActivityManager.getService()); ---> so getApplication() in service get custom application
--> if have customApplication, the code : "Application.class.equals(getApplication().getClass()" in Service will be false , even it's in backup mode
trace:
5 java.lang.IllegalStateException:WorkManager needs to be initialized via a ContentProvider#onCreate() or an Application#onCreate().
6 androidx.work.impl.background.systemjob.SystemJobService.onCreate(SystemJobService.java:68)
7 android.app.ActivityThread.handleCreateService(ActivityThread.java:3133)
8 android.app.ActivityThread.access$1900(ActivityThread.java:196)
9 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1622)
10 com.android.tony.defenselib.hook.HookHandle$1.handleMessage(HookHandle.java:30)
11 android.os.Handler.dispatchMessage(Handler.java:107)
12 android.os.Looper.loop(Looper.java:210)
13 android.app.ActivityThread.main(ActivityThread.java:5982)
14 java.lang.reflect.Method.invoke(Native Method)
15 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:852)
16 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)
this code cause crash:
if (!Application.class.equals(getApplication().getClass())) {
// During auto-backup, we don't get a custom Application subclass. This code path
// indicates we are either performing auto-backup or the user never used a custom
// Application class (or both).
throw new IllegalStateException("WorkManager needs to be initialized via a "
+ "ContentProvider#onCreate() or an Application#onCreate().");
}
my analysis:
code in handleCreateService() in ActivityThread.java:
" Application app = packageInfo.makeApplication(false, mInstrumentation);
service.attach(context, this,
"
handleCreateService--->. Application app = packageInfo.makeApplication(false, mInstrumentation); ---> forceDefaultAppClass is always false-->if have custom Application,will make custom Application ---> service.attach(context, this,
--> if have customApplication, the code : "Application.class.equals(getApplication().getClass()" in Service will be false , even it's in backup mode
fr...@gmail.com <fr...@gmail.com> #13
i'm also having the same crash, here is the relevant stacktrace:
compileSdkVersion 30
implementation 'androidx.work:work-runtime-ktx:2.4.0'
Crash
TCT (Alcatel) 5056D
Android 6.0 (SDK 23)
48.aab
2 hours ago
java.lang.RuntimeException:
at android.app.ActivityThread.handleCreateService (ActivityThread.java:2887)
at android.app.ActivityThread.access$1900 (ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1427)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:148)
at android.app.ActivityThread.main (ActivityThread.java:5417)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:616)
Caused by: java.lang.IllegalStateException:
at androidx.work.impl.background.systemjob.SystemJobService.onCreate (SystemJobService.java:2)
at android.app.ActivityThread.handleCreateService (ActivityThread.java:2877)
at android.app.ActivityThread.access$1900 (ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1427)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:148)
at android.app.ActivityThread.main (ActivityThread.java:5417)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:616)
What could the walkaround this issue? Is there another way to initialize the WorkManager instance? I'm using
private fun getWorkManager(): WorkManager =
try {
WorkManager.getInstance(App.context)
} catch (e: Exception) {
e.printStackTrace()
sleep(100)
getWorkManager()
}
compileSdkVersion 30
implementation 'androidx.work:work-runtime-ktx:2.4.0'
Crash
TCT (Alcatel) 5056D
Android 6.0 (SDK 23)
48.aab
2 hours ago
java.lang.RuntimeException:
at android.app.ActivityThread.handleCreateService (ActivityThread.java:2887)
at android.app.ActivityThread.access$1900 (ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1427)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:148)
at android.app.ActivityThread.main (ActivityThread.java:5417)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:616)
Caused by: java.lang.IllegalStateException:
at androidx.work.impl.background.systemjob.SystemJobService.onCreate (SystemJobService.java:2)
at android.app.ActivityThread.handleCreateService (ActivityThread.java:2877)
at android.app.ActivityThread.access$1900 (ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1427)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:148)
at android.app.ActivityThread.main (ActivityThread.java:5417)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:616)
What could the walkaround this issue? Is there another way to initialize the WorkManager instance? I'm using
private fun getWorkManager(): WorkManager =
try {
WorkManager.getInstance(App.context)
} catch (e: Exception) {
e.printStackTrace()
sleep(100)
getWorkManager()
}
fr...@gmail.com <fr...@gmail.com> #14
Same Error on production when call WorkManager.getInstance(context):
Library version: androidx.work:work-runtime:2.4.0
Samsung Galaxy S8 (dreamlte), 3840MB RAM, Android 9
java.lang.RuntimeException:
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6227)
at android.app.ActivityThread.access$1200 (ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1785)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7050)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:965)
Caused by: java.lang.IllegalStateException:
at androidx.work.impl.WorkManagerImpl.getInstance (WorkManagerImpl.java:150)
at androidx.work.WorkManager.getInstance (WorkManager.java:184)
at br.com.rcgm.dicaslotofacilfull.task.WorkRequestSincronizarConcurso.enfileirar (WorkRequestSincronizarConcurso.java:20)
at br.com.rcgm.dicaslotofacilfull.BaseApplication.onCreate (BaseApplication.java:23)
at android.app.Instrumentation.callApplicationOnCreate (Instrumentation.java:1154)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6222)
Library version: androidx.work:work-runtime:2.4.0
Samsung Galaxy S8 (dreamlte), 3840MB RAM, Android 9
java.lang.RuntimeException:
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6227)
at android.app.ActivityThread.access$1200 (ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1785)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7050)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:965)
Caused by: java.lang.IllegalStateException:
at androidx.work.impl.WorkManagerImpl.getInstance (WorkManagerImpl.java:150)
at androidx.work.WorkManager.getInstance (WorkManager.java:184)
at br.com.rcgm.dicaslotofacilfull.task.WorkRequestSincronizarConcurso.enfileirar (WorkRequestSincronizarConcurso.java:20)
at br.com.rcgm.dicaslotofacilfull.BaseApplication.onCreate (BaseApplication.java:23)
at android.app.Instrumentation.callApplicationOnCreate (Instrumentation.java:1154)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6222)
sh...@google.com <sh...@google.com>
sh...@google.com <sh...@google.com> #15
Hi,
I'm also facing same issue, in few devices.
Instance access : WorkManager.getInstance()
I'm not doing on-demand Initialization.
version used: 'androidx.work:work-runtime:2.3.4'
Device details
Brand: samsung
Model: Galaxy J2 Pro
Android version: 6.0.1
Fatal Exception: java.lang.RuntimeException: Unable to create service androidx.work.impl.background.systemjob.SystemJobService: java.lang.IllegalStateException: WorkManager needs to be initialized via a ContentProvider#onCreate() or an Application#onCreate().
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3883)
at android.app.ActivityThread.-wrap8(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1909)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by java.lang.IllegalStateException: WorkManager needs to be initialized via a ContentProvider#onCreate() or an Application#onCreate().
at androidx.work.impl.background.systemjob.SystemJobService.onCreate(SystemJobService.java:73)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3873)
at android.app.ActivityThread.-wrap8(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1909)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
I'm also facing same issue, in few devices.
Instance access : WorkManager.getInstance()
I'm not doing on-demand Initialization.
version used: 'androidx.work:work-runtime:2.3.4'
Device details
Brand: samsung
Model: Galaxy J2 Pro
Android version: 6.0.1
Fatal Exception: java.lang.RuntimeException: Unable to create service androidx.work.impl.background.systemjob.SystemJobService: java.lang.IllegalStateException: WorkManager needs to be initialized via a ContentProvider#onCreate() or an Application#onCreate().
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3883)
at android.app.ActivityThread.-wrap8(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1909)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by java.lang.IllegalStateException: WorkManager needs to be initialized via a ContentProvider#onCreate() or an Application#onCreate().
at androidx.work.impl.background.systemjob.SystemJobService.onCreate(SystemJobService.java:73)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3873)
at android.app.ActivityThread.-wrap8(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1909)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
fr...@gmail.com <fr...@gmail.com> #17
deleted
ky...@mapbox.com <ky...@mapbox.com> #18
Still seeing this issue in 2.5.0 using default WorkManager.getInstance() initialization. How can we prevent this situation from occurring?
if (!Application.class.equals(getApplication().getClass())) {
// During auto-backup, we don't get a custom Application subclass. This code path
// indicates we are either performing auto-backup or the user never used a custom
// Application class (or both).
throw new IllegalStateException("WorkManager needs to be initialized via a "
+ "ContentProvider#onCreate() or an Application#onCreate().");
}
if (!Application.class.equals(getApplication().getClass())) {
// During auto-backup, we don't get a custom Application subclass. This code path
// indicates we are either performing auto-backup or the user never used a custom
// Application class (or both).
throw new IllegalStateException("WorkManager needs to be initialized via a "
+ "ContentProvider#onCreate() or an Application#onCreate().");
}
ky...@mapbox.com <ky...@mapbox.com> #19
this issue on workManager 2.5.0 when initialize WorkManager in background thread, bring it back to UI thread
ky...@mapbox.com <ky...@mapbox.com> #20
I begin to see this issue after using "on demand Initialization"
Stacktrace:
Caused by java.lang.IllegalStateException
WorkManager needs to be initialized via a ContentProvider#onCreate() or an Application#onCreate().
androidx.work.impl.background.systemjob.SystemJobService.onCreate (SystemJobService.java:73)
android.app.ActivityThread.handleCreateService (ActivityThread.java:3833)
android.app.ActivityThread.access$1500 (ActivityThread.java:229)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1881)
android.os.Handler.dispatchMessage (Handler.java:106)
android.os.Looper.loop (Looper.java:226)
android.app.ActivityThread.main (ActivityThread.java:7178)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:503)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:942)
For now, the device affected is
android 9 Realme.
Work Manager version: 2.6.0
Stacktrace:
Caused by java.lang.IllegalStateException
WorkManager needs to be initialized via a ContentProvider#onCreate() or an Application#onCreate().
androidx.work.impl.background.systemjob.SystemJobService.onCreate (SystemJobService.java:73)
android.app.ActivityThread.handleCreateService (ActivityThread.java:3833)
android.app.ActivityThread.access$1500 (ActivityThread.java:229)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1881)
android.os.Handler.dispatchMessage (Handler.java:106)
android.os.Looper.loop (Looper.java:226)
android.app.ActivityThread.main (ActivityThread.java:7178)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:503)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:942)
For now, the device affected is
android 9 Realme.
Work Manager version: 2.6.0
fr...@gmail.com <fr...@gmail.com> #21
Still happening with WorkManager 2.7.1 Samsung Galaxy S21 Ultra 5G Android 12 (SDK 31)
java.lang.RuntimeException:
at android.app.ActivityThread.handleCreateService (ActivityThread.java:4953)
at android.app.ActivityThread.access$1900 (ActivityThread.java:310)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2300)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loopOnce (Looper.java:226)
at android.os.Looper.loop (Looper.java:313)
at android.app.ActivityThread.main (ActivityThread.java:8669)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1135)
Caused by: java.lang.IllegalStateException:
at androidx.work.impl.WorkManagerImpl.getInstance (WorkManagerImpl.java:158)
at androidx.work.impl.foreground.SystemForegroundDispatcher.<init> (SystemForegroundDispatcher.java:105)
at androidx.work.impl.foreground.SystemForegroundService.initializeDispatcher (SystemForegroundService.java:96)
at androidx.work.impl.foreground.SystemForegroundService.onCreate (SystemForegroundService.java:59)
at android.app.ActivityThread.handleCreateService (ActivityThread.java:4940)
at android.app.ActivityThread.access$1900 (ActivityThread.java:310)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2300)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loopOnce (Looper.java:226)
at android.os.Looper.loop (Looper.java:313)
at android.app.ActivityThread.main (ActivityThread.java:8669)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1135)
Description
Devices/Android versions reproduced on: (does not matter, library bug) Android 10, Samsung Galaxy Note 10 Lite
Android Auto version reproduced on: (does not matter, library bug) 5.8.604354-release
If this is a bug in the library, we would appreciate if you could attach, if possible:
- Sample project to trigger the issue.
- A screen record or screenshots showing the issue (if UI related).
Added screenshots 'GoogleMaps-rail' and 'MyApp-rail'.
- A bug report.
We want to recreate the effect that Google Maps has; (see "GoogleMaps-rail")
That is a colored circle behind an arrow, for in the rail-widget (using notifications)
This is not possible using a Large-Icon alone; as can be seen in the "MyApp-rail" screenshot.
The LargeIcon is not shown large enough the reach the top and bottom.
Google Maps seems to use 'setColor' on the extender to make the whole circle green.
The problem is that the CarAppExtender does not contain the setColor-method, the CarExtender does.
Please add the setColor-method to the CarAppExtender, same as on the CarExtender.