You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On one hand, an .apk file is no more than a general zip, i.e., generally, as long as one wants to, one can put any type of file to it
On the other hand, an .apk file is a specific zip, where, the AndroidManifest.xml describes the semantic of the it, and semantically, the description of AndroidManifest.xml and files in the .apk satisfy the constraint of Android platform; generally, there are three type of file apk
resources.arsc: a binary file illustrating the resources, including the resource table
res/: directory saving all resources used (exactly the res dir in developement)
others: other files, explained by the app and its dependent libraries, e.g.,
META-INF/: meta files, the de facto jar meta-inf
assets/: assets except resources
kotlin/: kotlin related files
An apk is not required to be runnable, it can have resources only like the overlays; actually, almost all things inside Android are packed as an apk, e.g., the Instrumentation test, the overlay
DEX, OAT, ODEX, VDEX, ART
.dex: DEX bytecode
.odex: optimized DEX bytecode, also .dex format but optimized (e.g., replacing some instructions to more-efficient instructions) by the deprecated on-device dexopt tool at installation time to get better interpreter performance
on newer versions, this file is an .oat ELF file but suffixed with .odex
.vdex: verified verbose DEX bytecode, also .dex format but with some more meta data to speed up verification; it contains a copy of the original .dex file
.oat: an ELF file that is generated by dex2oat, this file does not guarantee to contain AOT-compiled code
on some versions, .odex format generated by dex2oat may be an alternative to .oat format
in older versions, .oat (or .odex) contains a copy of the original .dex file; however, in newer versions (>= Android 8.0), the copy is moved to .vdex, and .oat (.odex) contains only the AOT-compiled code
.art: part of the runtime’s image (simply, a variant of heap dump of mirrored C++ objects) to speed up application startup (by avoiding the creation of art::mirror::Class etc.); it especially stores some well-known classes (e.g., java.lang.*)
connglli
changed the title
Deep Into Binaries (APK, DEX, OAT, ODEX, VDEX)
Deep Into Binaries (APK, DEX, OAT, ODEX, VDEX, ART)
Jun 2, 2020
connglli
changed the title
Deep Into Binaries (APK, DEX, OAT, ODEX, VDEX, ART)
Android Compilation Process and Binaries (APK, DEX, OAT, ODEX, VDEX, ART)
Jun 4, 2020
Compilation
References
ART and DVM
At installation time, the installer will separate the .dex, native code and resources.
At the first time of running,
References
APK
On one hand, an .apk file is no more than a general zip, i.e., generally, as long as one wants to, one can put any type of file to it
On the other hand, an .apk file is a specific zip, where, the
AndroidManifest.xml
describes the semantic of the it, and semantically, the description ofAndroidManifest.xml
and files in the .apk satisfy the constraint of Android platform; generally, there are three type of file apkAndroidManifest.xml
fileclasses.dex
,classes2.dex
, ...lib/x86/
: dependent x86 shared objects (ELF .so)lib/x86_64/
: dependent x86_64 shared objects (ELF .so)lib/armeabi/
: dependent arm32 shared objects (ELF .so)lib/armeabi-v7a/
: dependent arm32 (v7a stands for a version) shared objects (ELF .so)lib/arm64/
: dependent arm64 shared objects (ELF .so)lib/arm64-v8a/
: dependent arm64 (v8a stands for a version) shared objects (ELF .so)lib/mips/
: dependent mips shared objects (ELF .so)resources.arsc
: a binary file illustrating the resources, including the resource tableres/
: directory saving all resources used (exactly the res dir in developement)META-INF/
: meta files, the de facto jar meta-infassets/
: assets except resourceskotlin/
: kotlin related filesAn apk is not required to be runnable, it can have resources only like the overlays; actually, almost all things inside Android are packed as an apk, e.g., the Instrumentation test, the overlay
DEX, OAT, ODEX, VDEX, ART
art::mirror::Class
etc.); it especially stores some well-known classes (e.g.,java.lang.*
)References
The text was updated successfully, but these errors were encountered: