{"record":{"id":"bf2faa98e9456784","repo":"pxb1988/dex2jar","slug":"endian-tag-unsupported","errorCode":null,"errorMessage":"Endian_tag unsupported","messagePattern":"Endian_tag unsupported","errorType":"exception","errorClass":"DexException","httpStatus":null,"severity":"error","filePath":"dex-reader/src/main/java/com/googlecode/d2j/reader/DexFileReader.java","lineNumber":181,"sourceCode":"        } else {\r\n            throw new DexException(\"Magic unsupported.\");\r\n        }\r\n        int version = in.getInt() >> 8;\r\n        if (version < DEX_035 || version > DEX_040) {\r\n            System.err.println(\"Unknown DEX version. Trying anyway...\");\r\n        }\r\n        this.dex_version = version;\r\n        in.order(ByteOrder.LITTLE_ENDIAN);\r\n\r\n        // skip uint checksum\r\n        // and 20 bytes signature\r\n        // and uint file_size\r\n        // and uint header_size 0x70\r\n        skip(in, 4 + 20 + 4 + 4);\r\n\r\n        int endian_tag = in.getInt();\r\n        if (endian_tag != ENDIAN_CONSTANT) {\r\n            throw new DexException(\"Endian_tag unsupported\");\r\n        }\r\n\r\n        // skip uint link_size\r\n        // and uint link_off\r\n        skip(in, 4 + 4);\r\n\r\n        int map_off = in.getInt();\r\n\r\n        string_ids_size = in.getInt();\r\n        int string_ids_off = in.getInt();\r\n        type_ids_size = in.getInt();\r\n        int type_ids_off = in.getInt();\r\n        proto_ids_size = in.getInt();\r\n        int proto_ids_off = in.getInt();\r\n        field_ids_size = in.getInt();\r\n        int field_ids_off = in.getInt();\r\n        method_ids_size = in.getInt();\r\n        int method_ids_off = in.getInt();\r","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/pxb1988/dex2jar/blob/b5bda4fb4935ae8b3869b422454ae3b3896c7bc1/dex-reader/src/main/java/com/googlecode/d2j/reader/DexFileReader.java#L163-L199","documentation":"After the magic check, DexFileReader reads the endian_tag field from the DEX header and requires it to equal ENDIAN_CONSTANT (0x12345678, little-endian). This DexException is thrown when the file declares any other endianness (e.g. REVERSE_ENDIAN_CONSTANT 0x78563412, big-endian dex), which the reader cannot decode. The file is structurally a dex but byte-ordered in a way this library does not support.","triggerScenarios":"Opening a big-endian DEX (endian_tag 0x78563412) produced by tools targeting big-endian environments, or a file whose header is misaligned/corrupted so the 4 bytes read as an unexpected endian tag.","commonSituations":"DEX files from unusual toolchains or converted archives; header corruption from a bad transfer; hand-crafted dex for research that uses the reverse endian tag.","solutions":["Rebuild/re-export the dex with standard little-endian tooling (dx/d8) so endian_tag = 0x12345678","Hexdump the header and verify offset 0x28 (8 magic + 4 checksum + 20 signature + 4 file_size + 4 header_size) contains 78 56 34 12","Re-obtain the file if the header region appears corrupted","If you truly have a big-endian dex, byte-swap it or use a reader that supports REVERSE_ENDIAN_CONSTANT"],"exampleFix":"// before (hexdump at endian_tag offset)\n// 12 34 56 78 -> ok; 78 56 34 12 -> throws\n// after: rebuild with d8\n// d8 --output . classes/*.class  # produces little-endian classes.dex","handlingStrategy":"validation","validationCode":"static boolean hasStandardEndian(byte[] dex) {\n    if (dex == null || dex.length < 8 + 4 + 20 + 4 + 4 + 4) return false;\n    int off = 8 + 4 + 20 + 4 + 4; // magic + checksum + signature + file_size + header_size\n    int tag = (dex[off] & 0xFF) | (dex[off+1] & 0xFF) << 8\n            | (dex[off+2] & 0xFF) << 16 | (dex[off+3] & 0xFF) << 24;\n    return tag == 0x12345678;\n}","typeGuard":null,"tryCatchPattern":"try {\n    new DexFileReader(file);\n} catch (DexException e) {\n    if (e.getMessage().contains(\"Endian_tag\")) {\n        throw new UnsupportedOperationException(\"Big-endian DEX not supported: \" + file, e);\n    }\n    throw e;\n}","preventionTips":["Build dex with standard little-endian tools (d8/dx)","Check endian_tag (0x12345678) at header offset 0x28 before parsing","Treat REVERSE_ENDIAN_CONSTANT (0x78563412) files as unsupported and reconvert them","Verify dex checksum/signature to catch header corruption early"],"tags":["dex","endianness","file-format"],"backgroundTag":"invalid-config-value","analyzedSha":"b5bda4fb4935ae8b3869b422454ae3b3896c7bc1","analyzedAt":"2026-09-08T00:44:01.258Z","contentChangedAt":"2026-09-08T00:44:01.258Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}