pxb1988/dex2jar · error · RuntimeException

not support

Error message

not support

What it means

EncodedValue.wrap() converts Java objects into dex encoded values for a known set of types (primitives, strings, types, fields, methods, method handles, proto ids). Passing an object type it has no mapping for falls through to 'throw new RuntimeException("not support").'

Solutions

  1. Pre-convert the value into a supported type (Integer, String, TypeIdItem, MethodIdItem, etc.) before wrapping
  2. Handle nested annotations/enums via their dedicated EncodedValue subtypes manually
  3. Extend wrap() with a branch for your value type if you control the code

Example fix

// before
EncodedValue.wrap(myEnumObject);
// after
EncodedValue.wrap(new EncodedValue(VALUE_ENUM, fieldIdItem));
Defensive patterns

Strategy: type-guard

Validate before calling

static boolean isWrappable(Object v) {
    return v instanceof Integer || v instanceof Long || v instanceof Short || v instanceof Byte
        || v instanceof Character || v instanceof Boolean || v instanceof Float || v instanceof Double
        || v instanceof String || v instanceof TypeIdItem || v instanceof FieldIdItem
        || v instanceof MethodIdItem || v instanceof ProtoIdItem || v instanceof MethodHandleItem;
}

Type guard

if (!(v instanceof String || v instanceof Number || v instanceof Character || v instanceof Boolean || v instanceof TypeIdItem || v instanceof FieldIdItem || v instanceof MethodIdItem || v instanceof ProtoIdItem)) { /* convert or reject */ }

Try / catch

try { return EncodedValue.wrap(v); } catch (RuntimeException e) { if ("not support".equals(e.getMessage())) return encodeManually(v); throw e; }

Prevention

When it happens

Trigger: Calling EncodedValue.wrap(v) with an unsupported object type (e.g. arbitrary POJO, array of unsupported elements, null-ish custom wrapper) when building annotation or static-field values.

Common situations: Annotation processors passing complex annotation members (Class arrays, nested annotations handled elsewhere, enums as raw objects) into the dex writer.

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 pxb1988/dex2jar@b5bda4fb49 (2026-09-08). Data as JSON: /api/errors/6d78caf11fca89cc. Report an issue: GitHub.

Appendix: source

Thrown at dex-writer/src/main/java/com/googlecode/d2j/dex/writer/ev/EncodedValue.java:136

            return new EncodedValue(VALUE_BOOLEAN, v);
        } else if (v instanceof Byte) {
            return new EncodedValue(VALUE_BYTE, v);
        } else if (v instanceof TypeIdItem) {
            return new EncodedValue(VALUE_TYPE, v);
        } else if (v instanceof StringIdItem) {
            return new EncodedValue(VALUE_STRING, v);
        } else if (v instanceof FieldIdItem) {
            return new EncodedValue(VALUE_FIELD, v);
        } else if (v instanceof MethodIdItem) {
            return new EncodedValue(VALUE_METHOD, v);
        } else if (v instanceof MethodHandleItem) {
            return new EncodedValue(VALUE_METHOD_HANDLE, v);
        } else if (v instanceof ProtoIdItem) {
            return new EncodedValue(VALUE_METHOD_TYPE, v);
        }


        throw new RuntimeException("not support");
    }

    public static EncodedValue defaultValueForType(String typeString) {
        switch (typeString.charAt(0)) {
            case '[':
            case 'L':
                return new EncodedValue(VALUE_NULL, null);
            case 'B':
                return new EncodedValue(VALUE_BYTE, (byte) 0);
            case 'Z':
                return new EncodedValue(VALUE_BOOLEAN, false);
            case 'S':
                return new EncodedValue(VALUE_SHORT, (short) 0);
            case 'C':
                return new EncodedValue(VALUE_CHAR, (char) 0);
            case 'I':
                return new EncodedValue(VALUE_INT, (int) 0);
            case 'F':

View on GitHub (pinned to b5bda4fb49)