microg/GmsCore · error · IllegalStateException

The fully qualified name of the implementation of OptionsPro

Error message

The fully qualified name of the implementation of OptionsProvider must be provided as a metadata in the AndroidManifest.xml with key com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME.

What it means

Error "The fully qualified name of the implementation of OptionsProvider must be provided as a metadata in the AndroidManifest.xml with key com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME." thrown in microg/GmsCore.

Source

Thrown at play-services-cast-framework/src/main/java/com/google/android/gms/cast/framework/CastContext.java:180

                if (sessionProvider == null) throw new IllegalArgumentException("Additional SessionProvider must not be null.");
                if (sessionProvider.getCategory() == null || sessionProvider.getCategory().isEmpty())
                    throw new IllegalArgumentException("Category for SessionProvider must not be null or empty string.");
                if (map.containsKey(sessionProvider.getCategory()))
                    throw new IllegalArgumentException("SessionProvider for category " + sessionProvider.getCategory() + " already added");
                map.put(sessionProvider.getCategory(), sessionProvider.asBinder());
            }
        }
        return map;
    }

    private static OptionsProvider getOptionsProvider(Context context) {
        try {
            Bundle metaData = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA).metaData;
            String optionsProviderClassName = metaData.getString(OPTIONS_PROVIDER_CLASS_NAME_KEY);
            if (optionsProviderClassName != null) {
                return Class.forName(optionsProviderClassName).asSubclass(OptionsProvider.class).getDeclaredConstructor().newInstance();
            }
            throw new IllegalStateException("The fully qualified name of the implementation of OptionsProvider must be provided as a metadata in the AndroidManifest.xml with key com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME.");
        } catch (PackageManager.NameNotFoundException | ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InstantiationException |
                 InvocationTargetException | NullPointerException e) {
            throw new IllegalStateException("Failed to initialize CastContext.", e);
        }
    }

    @NonNull
    DiscoveryManager getDiscoveryManager() {
        return discoveryManager;
    }
}

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Declare <meta-data android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME" android:value="your.package.YourOptionsProvider"/> in the app's AndroidManifest.xml
  2. Ensure the named class implements CastContext.OptionsProvider and has a no-arg constructor
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at play-services-cast-framework/src/main/java/com/google/android/gms/cast/framework/CastContext.java:180 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/bc6baa2211ed6327. Report an issue: GitHub.