microg/GmsCore · error · UnsupportedOperationException

onSuccessTask is not implemented

Error message

onSuccessTask is not implemented

What it means

The no-executor onSuccessTask(SuccessContinuation) overload is an unimplemented stub: it throws UnsupportedOperationException unconditionally. Success-only task chaining (running a follow-up task only when this task succeeds) is not available through this method.

Source

Thrown at play-services-tasks/src/main/java/com/google/android/gms/tasks/Task.java:277

     */
    public abstract boolean isComplete();

    /**
     * Returns {@code true} if the Task has completed successfully; {@code false} otherwise.
     */
    public abstract boolean isSuccessful();

    /**
     * Returns a new Task that will be completed with the result of applying the specified SuccessContinuation to this Task when this Task completes successfully. If the previous Task fails, the onSuccessTask completion will be skipped and failure listeners will be invoked.
     * <p>
     * The SuccessContinuation will be called on the main application thread.
     * <p>
     * If the previous Task is canceled, the returned Task will also be canceled and the SuccessContinuation would not execute.
     *
     * @see SuccessContinuation#then
     */
    public <TContinuationResult> Task<TContinuationResult> onSuccessTask(SuccessContinuation<TResult, TContinuationResult> successContinuation) {
        throw new UnsupportedOperationException("onSuccessTask is not implemented");
    }

    /**
     * Returns a new Task that will be completed with the result of applying the specified SuccessContinuation to this Task when this Task completes successfully. If the previous Task fails, the onSuccessTask completion will be skipped and failure listeners will be invoked.
     * <p>
     * If the previous Task is canceled, the returned Task will also be canceled and the SuccessContinuation would not execute.
     *
     * @param executor the executor to use to call the SuccessContinuation
     * @see SuccessContinuation#then
     */
    public <TContinuationResult> Task<TContinuationResult> onSuccessTask(Executor executor, SuccessContinuation<TResult, TContinuationResult> successContinuation) {
        throw new UnsupportedOperationException("onSuccessTask is not implemented");
    }

}

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Use the library's supported composition API instead
  2. Guard inside addOnSuccessListener/addOnCompleteListener and launch the next task only when isSuccessful() is true
  3. Catch UnsupportedOperationException and fall back to listener-based chaining
  4. Refactor the SuccessContinuation logic into a normal listener callback

Example fix

// before
task.onSuccessTask(t -> fetchProfile(t.getResult()));
// after
task.addOnSuccessListener(result -> fetchProfile(result));
Defensive patterns

Strategy: try-catch

Try / catch

try {
    Task<R> r = task.onSuccessTask(cont);
} catch (UnsupportedOperationException e) {
    task.addOnSuccessListener(result -> { /* launch next task */ });
}

Prevention

When it happens

Trigger: Calling task.onSuccessTask(successContinuation) on any Task — always throws.

Common situations: Ported Firebase code using onSuccessTask for sequential async flows; copying official Play Services samples against this implementation.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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