skylot/jadx · error · JadxRuntimeException
Unexpected field type class:
Error message
Unexpected field type class:
What it means
Thrown by AnnotationGen.encodeValue() when processing an ENCODED_ENUM or ENCODED_FIELD annotation value whose backing object is neither an IFieldRef nor a FieldInfo. These are the only two expected types for static field references in annotation values; any other type indicates an internal inconsistency in how the annotation was parsed from the DEX.
Source
Thrown at jadx-core/src/main/java/jadx/core/codegen/AnnotationGen.java:196
code.add(StringUtils.formatDouble((Double) value));
break;
case ENCODED_STRING:
code.add(stringUtils.unescapeString((String) value));
break;
case ENCODED_TYPE:
classGen.useType(code, ArgType.parse((String) value));
code.add(".class");
break;
case ENCODED_ENUM:
case ENCODED_FIELD:
// must be a static field
if (value instanceof IFieldRef) {
FieldInfo fieldInfo = FieldInfo.fromRef(root, (IFieldRef) value);
InsnGen.makeStaticFieldAccess(code, fieldInfo, classGen);
} else if (value instanceof FieldInfo) {
InsnGen.makeStaticFieldAccess(code, (FieldInfo) value, classGen);
} else {
throw new JadxRuntimeException("Unexpected field type class: " + value.getClass());
}
break;
case ENCODED_METHOD:
// TODO
break;
case ENCODED_ARRAY:
code.add('{');
Iterator<?> it = ((Iterable<?>) value).iterator();
while (it.hasNext()) {
EncodedValue v = (EncodedValue) it.next();
encodeValue(cls.root(), code, v);
if (it.hasNext()) {
code.add(", ");
}
}
code.add('}');
break;
case ENCODED_ANNOTATION:View on GitHub (pinned to e738a26571)
Solutions
- Report the APK/APK file as a test case to the jadx project — this is likely an internal jadx bug in annotation processing.
- Update to the latest jadx version where the annotation value handling may have been fixed.
- As a workaround, exclude the affected class from decompilation or use --no-debug-info / fallback mode.
Defensive patterns
Strategy: try-catch
Try / catch
try {
annotationGen.encodeValue(root, code, encodedValue);
} catch (JadxRuntimeException e) {
if (e.getMessage().startsWith("Unexpected field type class")) {
// Fallback: emit a comment with the raw value instead of failing
code.add("/* unexpected annotation field value: " + value + " */");
logger.warn("Skipping annotation field with unexpected type", e);
} else {
throw e;
}
} Prevention
- This is an internal jadx bug — report the APK to the project.
- Use fallback decompilation mode to bypass annotation generation for problematic classes.
- Keep jadx updated — annotation processing is actively improved.
When it happens
Trigger: Decompiling a DEX/APK where an annotation references a field (enum constant or static field) and the value object produced by the dex parser is an unexpected type. This usually indicates a bug in the annotation attribute processing pipeline or a malformed DEX.
Common situations: Obfuscated or modified APKs with non-standard annotation structures. A jadx version regression in annotation parsing that produces a different value wrapper type than expected.
Related errors
- Can't decode value:
- Unknown output format
- Unknown condition mode:
- Unknown arg type
- Unknown instruction:
AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14).
Data as JSON: /api/errors/e4623e2de198556a.
Report an issue: GitHub.