pxb1988/dex2jar · error · RuntimeException

Can't merge and

Error message

Can't merge ${thizCls} and ${clz}

What it means

Raised by TypeClass.merge during dex-to-ir type inference when two type-class constraints meet at a control-flow merge point and neither is UNKNOWN: at least one is fixed (or the combination is otherwise incompatible, e.g. a reference type meeting a primitive), so no single TypeClass can represent both. This is a type-inference limitation of the converter, not bad user input; the known I/Z merge case is specially handled above this branch.

Solutions

  1. Update to a newer dex2jar release — type-merging rules have been extended over time (e.g. the special I/Z case referenced in the source)
  2. Report the failing classes to the dex2jar issue tracker with the input dex so the merge rules can be improved
  3. As a workaround, exclude the offending class(es) from translation to get partial output
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at dex-ir/src/main/java/com/googlecode/dex2jar/ir/TypeClass.java:104 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of pxb1988/dex2jar@b5bda4fb49 (2026-09-08). Data as JSON: /api/errors/56ae86a8f8fe1bc8. Report an issue: GitHub.

Appendix: source

Thrown at dex-ir/src/main/java/com/googlecode/dex2jar/ir/TypeClass.java:104

    public static TypeClass merge(TypeClass thizCls, TypeClass clz) {
        if (thizCls == clz) {
            return thizCls;
        }
        if (thizCls == TypeClass.UNKNOWN) {
            return clz;
        } else if (clz == TypeClass.UNKNOWN) {
            // do nothing
            return thizCls;
        } else {
            if (thizCls.fixed) {
                if (clz.fixed) {
                    // special case for merge I and Z
                    // https://bitbucket.org/pxb1988/dex2jar/issues/1/javalangruntimeexception-can-not-merge-i
                    // http://sourceforge.net/p/dex2jar/tickets/237/
                    if ((thizCls == INT && clz == BOOLEAN) || (thizCls == BOOLEAN || clz == INT)) {
                        return INT;
                    }
                    throw new RuntimeException("Can't merge " + thizCls + " and " + clz);
                } else {
                    return thizCls;
                }
            } else if (clz.fixed) {
                return clz;
            } else { // both not fixed
                return merge0(thizCls, clz);
            }
        }
    }

    /**
     * X     ZIL   ZIFL ZIF  ZI  IF
     * ZIL   X     ZIL  ZI   ZI  I
     * ZIFL  ZIL   X    ZIF  ZI  IF
     * ZIF   ZI    ZIF  X    ZI  IF
     * ZI    ZI    ZI   ZI   X   I
     * IF    I     IF   IF   I   X

View on GitHub (pinned to b5bda4fb49)