Package com.android.dex
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
Modifier and TypeFieldDescriptionstatic final int
API level to target in order to generate const-method-handle and const-method-typestatic final int
API level to target in order to produce the most modern file formatstatic final int
API level to target in order to define default and static interface methodsstatic final int
API level to target in order to invoke default and static interface methodsstatic final int
API level at which the invocation of static interface methods is permitted by dx.static final int
API level to target in order to generate invoke-polymorphic and invoke-customstatic final int
API level to target in order to suppress extended opcode usagestatic final int
API level to target in order to allow spaces in SimpleNamestatic final String
file name of the primary.dex
file inside an application or library.jar
filestatic final int
value used to indicate endianness of file contentsstatic final String
common prefix for all dex file "magic numbers"static final String
common suffix for all dex file "magic numbers"static final int
Maximum addressable field or method index.static final int
Maximum addressable type index.static final String
Dex file version number for dalvik.static final String
dex file version number for API level 10000 and earlierstatic final String
dex file version number for API level 13 and earlierstatic final String
dex file version number for API level 24 and earlierstatic final String
dex file version number for API level 26 and earlierstatic final String
dex file version number for API level 28 and earlier -
Method Summary
Modifier and TypeMethodDescriptionstatic String
apiToMagic
(int targetApiLevel) Returns the magic number corresponding to the given target API level.static boolean
isSupportedDexMagic
(byte[] magic) Checks whether a DEX file magic string is supported.static int
magicToApi
(byte[] magic) Returns the API level corresponding to the given magic number, or-1
if 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.dex
file inside an application or library.jar
file- See Also:
-
MAGIC_PREFIX
common prefix for all dex file "magic numbers"- See Also:
-
MAGIC_SUFFIX
common suffix for all dex file "magic numbers"- See Also:
-
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-1
if 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:
-