Class DexFormat
java.lang.Object
com.android.dex.DexFormat
Constants that show up in and are otherwise related to
.dex
files, and helper methods for same.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAPI level to target in order to generate const-method-handle and const-method-typestatic final intAPI level to target in order to produce the most modern file formatstatic final intAPI level to target in order to define default and static interface methodsstatic final intAPI level to target in order to invoke default and static interface methodsstatic final intAPI level at which the invocation of static interface methods is permitted by dx.static final intAPI level to target in order to generate invoke-polymorphic and invoke-customstatic final intAPI level to target in order to suppress extended opcode usagestatic final intAPI level to target in order to allow spaces in SimpleNamestatic final Stringfile name of the primary.dexfile inside an application or library.jarfilestatic final intvalue used to indicate endianness of file contentsstatic final Stringcommon prefix for all dex file "magic numbers"static final Stringcommon suffix for all dex file "magic numbers"static final intMaximum addressable field or method index.static final intMaximum addressable type index.static final StringDex file version number for dalvik.static final Stringdex file version number for API level 10000 and earlierstatic final Stringdex file version number for API level 13 and earlierstatic final Stringdex file version number for API level 24 and earlierstatic final Stringdex file version number for API level 26 and earlierstatic final Stringdex file version number for API level 28 and earlier -
Method Summary
Modifier and TypeMethodDescriptionstatic StringapiToMagic(int targetApiLevel) Returns the magic number corresponding to the given target API level.static booleanisSupportedDexMagic(byte[] magic) Checks whether a DEX file magic string is supported.static intmagicToApi(byte[] magic) Returns the API level corresponding to the given magic number, or-1if the given array is not a well-formed dex file magic number.
-
Field Details
-
API_SPACES_IN_SIMPLE_NAME
public static final int API_SPACES_IN_SIMPLE_NAMEAPI level to target in order to allow spaces in SimpleName- See Also:
-
API_CONST_METHOD_HANDLE
public static final int API_CONST_METHOD_HANDLEAPI level to target in order to generate const-method-handle and const-method-type- See Also:
-
API_METHOD_HANDLES
public static final int API_METHOD_HANDLESAPI level to target in order to generate invoke-polymorphic and invoke-custom- See Also:
-
API_DEFINE_INTERFACE_METHODS
public static final int API_DEFINE_INTERFACE_METHODSAPI level to target in order to define default and static interface methods- See Also:
-
API_INVOKE_INTERFACE_METHODS
public static final int API_INVOKE_INTERFACE_METHODSAPI level to target in order to invoke default and static interface methods- See Also:
-
API_INVOKE_STATIC_INTERFACE_METHODS
public static final int API_INVOKE_STATIC_INTERFACE_METHODSAPI level at which the invocation of static interface methods is permitted by dx. This value has been determined experimentally by testing on different VM versions.- See Also:
-
API_NO_EXTENDED_OPCODES
public static final int API_NO_EXTENDED_OPCODESAPI level to target in order to suppress extended opcode usage- See Also:
-
API_CURRENT
public static final int API_CURRENTAPI level to target in order to produce the most modern file format- See Also:
-
VERSION_FOR_API_10000
dex file version number for API level 10000 and earlier- See Also:
-
VERSION_FOR_API_28
dex file version number for API level 28 and earlier- See Also:
-
VERSION_FOR_API_26
dex file version number for API level 26 and earlier- See Also:
-
VERSION_FOR_API_24
dex file version number for API level 24 and earlier- See Also:
-
VERSION_FOR_API_13
dex file version number for API level 13 and earlier- See Also:
-
VERSION_CURRENT
Dex file version number for dalvik.Note: Dex version 36 was loadable in some versions of Dalvik but was never fully supported or completed and is not considered a valid dex file format.
- See Also:
-
DEX_IN_JAR_NAME
file name of the primary.dexfile inside an application or library.jarfile- See Also:
-
MAGIC_PREFIX
-
MAGIC_SUFFIX
-
ENDIAN_TAG
public static final int ENDIAN_TAGvalue used to indicate endianness of file contents- See Also:
-
MAX_MEMBER_IDX
public static final int MAX_MEMBER_IDXMaximum addressable field or method index. The largest addressable member is 0xffff, in the "instruction formats" spec as field@CCCC or meth@CCCC.- See Also:
-
MAX_TYPE_IDX
public static final int MAX_TYPE_IDXMaximum addressable type index. The largest addressable type is 0xffff, in the "instruction formats" spec as type@CCCC.- See Also:
-
-
Method Details
-
magicToApi
public static int magicToApi(byte[] magic) Returns the API level corresponding to the given magic number, or-1if the given array is not a well-formed dex file magic number.- Parameters:
magic- array of bytes containing DEX file magic string- Returns:
- API level corresponding to magic string if valid, -1 otherwise.
-
apiToMagic
Returns the magic number corresponding to the given target API level.- Parameters:
targetApiLevel- level of API (minimum supported value 13).- Returns:
- Magic string corresponding to API level supplied.
-
isSupportedDexMagic
public static boolean isSupportedDexMagic(byte[] magic) Checks whether a DEX file magic string is supported.- Parameters:
magic- string from DEX file- Returns:
-