Tencent/QMUI_Android · error · RuntimeException

method %s of interface FirstFragmentFinder not found

Error message

method %s of interface FirstFragmentFinder not found

What it means

BaseProcessor.getOverrideMethod searches the elements of an interface (contextually FirstFragmentFinder) for a method with the given name and throws if none is found. This is a compile-time annotation-processor failure: the processor expects a specific method on the interface that no longer exists in the current source.

Source

Thrown at arch-compiler/src/main/java/com/qmuiteam/qmui/arch/BaseProcessor.java:97

        mMessager = processingEnv.getMessager();
    }

    @Override
    public SourceVersion getSupportedSourceVersion() {
        return SourceVersion.latestSupported();
    }


    protected ExecutableElement getOverrideMethod(ClassName creator, String methodName) {
        TypeElement element = mElementUtils.getTypeElement(creator.toString());
        List<? extends Element> elements = element.getEnclosedElements();
        for (Element ele : elements) {
            if (ele.getKind() != ElementKind.METHOD) continue;
            if (methodName.equals(ele.getSimpleName().toString())) {
                return (ExecutableElement) ele;
            }
        }
        throw new RuntimeException(String.format("method %s of interface FirstFragmentFinder not found", methodName));
    }


    public void error(Element element, String message, Object... args) {
        printMessage(Diagnostic.Kind.ERROR, element, message, args);
    }

    public void waring(Element element, String message, Object... args) {
        printMessage(Diagnostic.Kind.WARNING, element, message, args);
    }

    public void note(Element element, String message, Object... args) {
        printMessage(Diagnostic.Kind.NOTE, element, message, args);
    }

    private void printMessage(Diagnostic.Kind kind, Element element, String message, Object[] args) {
        if (args.length > 0) {
            message = String.format(message, args);

View on GitHub (pinned to 026e7d4866)

Solutions

  1. Align arch and arch-compiler versions (upgrade both from the same QMUI release).
  2. Check the interface referenced by the processor and add/rename the expected method to match what getOverrideMethod looks for.
  3. Clean and rebuild so the processor re-runs against current sources.
  4. If it persists, inspect BaseProcessor.java:97 to see the exact methodName expected and restore it in your implementation.

Example fix

// before
class MyFinder : FirstFragmentFinder {
  override fun findFragmentByPageName(name: String): Fragment? = ...
}

// after
class MyFinder : FirstFragmentFinder {
  override fun findFragmentByPageName(name: String): Fragment? = ...
  override fun findFragmentByClassName(className: String): Fragment? = ... // method expected by processor restored
Defensive patterns

Strategy: validation

Validate before calling

// compile-time guard: ensure the finder interface still declares the method the processor expects
// run as part of the build:
// grep -q "findFragmentByClassName" FirstFragmentFinder.kt || exit 1

Type guard

fun Class<*>.declaresMethod(name: String): Boolean =
    methods.any { it.name == name }

Prevention

When it happens

Trigger: Running the arch-compiler processor while the interface being scanned (e.g. FirstFragmentFinder implementor source or a referenced interface) does not declare the expected method — usually after renaming/removing a method or a QMUI version mismatch between arch and arch-compiler.

Common situations: Upgrading the arch dependency but keeping an old arch-compiler (or vice versa); a developer renamed a finder method without updating the processor expectation; an annotated class implements the finder interface but misses the method.

Related errors


AI-assisted analysis of Tencent/QMUI_Android@026e7d4866 (2026-09-06). Data as JSON: /api/errors/0fa4495b2428d087. Report an issue: GitHub.