Skip to content

Crash in WorkerScheduler.startService #435

@upside-sarah

Description

@upside-sarah

Optimizely version: 3.10.1
Android versions: 6.0+

We have seen a repeated crash in our app related to the event rescheduler receiver. We have seen it reported in Google Play Store, but we have not been able to reproduce this crash locally, so it appears to be flaky. We added the receiver with the intent filters as described in the docs:

        <receiver android:enabled="true" android:exported="false" android:name="com.optimizely.ab.android.event_handler.EventRescheduler">
            <intent-filter>
                <action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
                <action android:name="android.net.wifi.supplicant.CONNECTION_CHANGE"/>
            </intent-filter>
        </receiver>

Is there something else that we need to do to ensure our WorkManager is initialized here? We have not implemented a custom event handler or rescheduler, and we currently do not register any handlers in the code (we only have this change in the AndroidManifest.xml), but it was unclear to me in the documentation if we need to implement anything else.

Thanks!

Stacktrace:

Exception java.lang.RuntimeException: Unable to start receiver com.optimizely.ab.android.event_handler.EventRescheduler: java.lang.IllegalStateException: WorkManager is not initialized properly.  You have explicitly disabled WorkManagerInitializer in your manifest, have not manually called WorkManager#initialize at this point, and your Application does not implement Configuration.Provider.
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3797)
  at android.app.ActivityThread.access$1400 (ActivityThread.java:219)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1870)
  at android.os.Handler.dispatchMessage (Handler.java:107)
  at android.os.Looper.loop (Looper.java:214)
  at android.app.ActivityThread.main (ActivityThread.java:7378)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:492)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:935)
Caused by java.lang.IllegalStateException: WorkManager is not initialized properly.  You have explicitly disabled WorkManagerInitializer in your manifest, have not manually called WorkManager#initialize at this point, and your Application does not implement Configuration.Provider.
  at androidx.work.impl.WorkManagerImpl.getInstance (WorkManagerImpl.java:158)
  at androidx.work.WorkManager.getInstance (WorkManager.java:184)
  at com.optimizely.ab.android.shared.WorkerScheduler.startService (WorkerScheduler.java:102)
  at com.optimizely.ab.android.shared.WorkerScheduler.startService (WorkerScheduler.java:75)
  at com.optimizely.ab.android.event_handler.EventRescheduler.reschedule (EventRescheduler.java:88)
  at com.optimizely.ab.android.event_handler.EventRescheduler.onReceive (EventRescheduler.java:72)
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:3788)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions