microg/GmsCore · error · IllegalStateException

Neither preferencesResource given, nor overriden getFragment

Error message

Neither preferencesResource given, nor overriden getFragment()

What it means

Configuration guard in AbstractDashboardActivity.getFragment: the subclass neither set preferencesResource nor overrode getFragment(), so there is no settings fragment to display. It fires from onCreate when both configuration avenues are missing.

Source

Thrown at play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/AbstractDashboardActivity.java:105

            evaluateConditionAsync(condition);
        }
    }

    private synchronized void addConditionToView(Condition condition) {
        for (int i = 0; i < conditionContainer.getChildCount(); i++) {
            if (conditionContainer.getChildAt(i).getTag() == condition) return;
        }
        conditionContainer.addView(condition.createView(this, conditionContainer));
    }

    protected void clearConditions() {
        conditions.clear();
        resetConditionViews();
    }

    protected Fragment getFragment() {
        if (preferencesResource == 0) {
            throw new IllegalStateException("Neither preferencesResource given, nor overriden getFragment()");
        }
        ResourceSettingsFragment fragment = new ResourceSettingsFragment();
        Bundle b = new Bundle();
        b.putInt(ResourceSettingsFragment.EXTRA_PREFERENCE_RESOURCE, preferencesResource);
        fragment.setArguments(b);
        return fragment;
    }
}

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Set preferencesResource in the activity's constructor or initialization block
  2. Override getFragment() to return the fragment to show
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at play-services-core/microg-ui-tools/src/main/java/org/microg/tools/ui/AbstractDashboardActivity.java:105 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/de6f84cf948d79d9. Report an issue: GitHub.