Anatomy of APK
An apk is just a ZIP archive. But how to find out what’s inside the apk. Its simple just remove the extension .apk and make it .zip then extract it. We will able to find these seven entries. I’m going to explain about these seven entries. These runs as follows :
- classes.dex : This contains compiled application code, transformed into dex bytecode. We might see more than one dex file in our apk, if we are using multidex to overcome 65536 method limit.
- res folder : This folder contains most xml resources(e.g layouts) and drawables (e.g. PNG, JPEG) in folders with various qualifiers, like mdpi-hdpi etc.
- resources.arsc : Some resources and identifiers are compiled and flattend into this file. It’s normally stored in the apk without compression for faster access during runtime.
- AndroidManifest.xml: Our application manifest is transformed during compilation into a binary format. Play Store uses certain information contained in the AndroidManifest to decide if an apk can be installed on a device etc.
- libs/ : Ehile making an application whatever the libraries we are using, those are stored in here.
- assets : This folder is used for any file assest that will not be used as Android type resources. Most commonly this will be font files or some game data like textures etc.
- META-INF : This folder is present in signed apk and contains a list of all files in the apk with their signatures.
In the next tutorial I’m going to show you on how to reduce the apk size which matters a lot among the developers.