microg/GmsCore · error · IllegalStateException

serviceHandler not set, did you override onCreate() but forg

Error message

serviceHandler not set, did you override onCreate() but forget to call super.onCreate()?

What it means

Lifecycle guard in WearableListenerService.onDestroy: serviceHandler is null, meaning onCreate() never ran its initialization — the subclass overrode onCreate() without calling super.onCreate(), so the handler thread and listener were never created.

Source

Thrown at play-services-wearable/src/main/java/com/google/android/gms/wearable/WearableListenerService.java:98

    @Override
    public void onCreate() {
        super.onCreate();
        handlerThread = new HandlerThread("WearableListenerService");
        handlerThread.start();
        serviceHandler = new ServiceHandler(handlerThread.getLooper());
        listener = new Listener();
    }

    @Override
    public void onDataChanged(DataEventBuffer dataEvents) {
    }

    @Override
    public void onDestroy() {
        synchronized (lock) {
            if (serviceHandler == null) {
                throw new IllegalStateException("serviceHandler not set, did you override onCreate() but forget to call super.onCreate()?");
            }
            serviceHandler.getLooper().quit();
        }
        super.onDestroy();
    }

    @PublicApi(exclude = true)
    public void onEntityUpdate(AmsEntityUpdate entityUpdate) {
    }

    @Override
    public void onInputClosed(Channel channel, @ChannelApi.CloseReason int closeReason, int appSpecificErrorCode) {
    }

    @Override
    public void onMessageReceived(MessageEvent messageEvent) {
    }

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Call super.onCreate() in the overriding onCreate()
  2. Do not invoke onDestroy() lifecycle paths before onCreate completes
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at play-services-wearable/src/main/java/com/google/android/gms/wearable/WearableListenerService.java:98 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06). Data as JSON: /api/errors/916e1b2155cbd9cd. Report an issue: GitHub.