What are APK files?
Even a moderately informed Android user would have heard of APK files at some point. They are the files which install themselves on Android devices as mobile apps. Any app you see on your Android device comes from an APK file.
This is not an incorrect understanding of APK files. There is however a lot more about APK files that people in the mobile app market must know.
The answer is simple. APKs are the final destination of every Android app. Knowing its ins-and-outs can help companies and entrepreneurs adapt to the changing trends in the world of Android later down the road.
What is an APK?
One way of defining APKs is referring to them as the packaged version of an app which can only be opened in an Android operating system.
This is a good way to understand the basic concept of APK files. More accurately, APKs are a file format used for the installation and distribution of mobile apps. If you visit Android stores besides the Google Play Store such as APKPure and APKMirror, you’ll have to download the APK version of your app and then proceed with installation.
Both Android application packages or Android package kit are accepted full forms of APKs.
This brings us to an interesting question – how does the Google Play Store install an app?
The contents of an APK file
What is an APK file made up of? We all know APKs are a compressed and packaged form of mobile apps. They contain many bits of code which come together to take the shape of a mobile app on an Android device.
What are the contents of an APK file? The following points touch upon the primary files in a typical APK file.
a. META-INF directory – The meta information directory contains a range of resources such as the manifest file, app certificate, and so on.
i. MANIFEST.MF – The manifest file contains information on all the other components of an APK file. Just as the manifest of a cargo contains details about the shipment, the manifest file in an APK file provides an outline on the contents of an APK file.
ii. App certificate – The app certificate is a vital part of an APK file. It helps the Google Play Store uniquely identify the mobile app. An app certificate is only created once. Thus, developers must keep it safe for all future iterations of the app
iii. CERT.SF – Provides a list of all the resources within an APK file. It also provides details on the specific locations the resources are listed in the manifest file.
b. LIB – It is a separate directory which contains resources which come into play based on the platform on which the device is working. LIB contains separate bits of code for different kinds of processors. These processors include ARMv7, ARMv8 arm64, x86, and x86 64.
c. Resources.arsc – A file containing all resources which have already been compiled by the developers. This is to ensure these resources are readily available when the app is live. Binary XML files for instance are kept in this file as precompiled resources.
d. Res – A file containing resources which have not been compiled and remain outside resources.arsc.
e. Assets – There are many resources an app needs to perform certain key tasks. The Assets file contains code which enables an app to perform certain key tasks.
f. Classes.dex – This DEX file contains the final code executed by Android Runtime. Every little code or asset in your APK file is converted into bits and executed within the classes.dex file.
g. AndroidManifest.xml – This manifest file provides information such as the app’s name, version number, permission information, and so on. You can convert this file into binary XML to read its contents.
These are the main contents of a typical APK file. Each performs a specific function during the installation and overall functioning of an Android app.
APK installation and Google Play Installation – The Difference
Most of us Android users generally download apps from the Google Play Store. We’re all familiar with the process – find an app and hit install.
There is an entire machinery working behind the scene which comes into life when you download an app from the Google Play Store. The section below describes the process in great detail.
What happens when you press ‘Install’ on the Google Play Store?
A recent study suggests users on average have forty mobile apps on their smartphone devices. This means Android users on average press the install button on the Google Play Store forty times at least.
What happens in the background when you press the ‘install’ button? The steps below explain what happens in the background when an app installs on your Android device.
- The Play Store starts downloading the APK file in your device storage.
- You do not have the privilege to open this file. You can only get Read/Write permissions after rooting your Android device.
- After the download finishes, your device initiates the installation process. The APK is automatically removed from your storage.
- Your app is ready for use.
The process above lays to rest the need for APKs. Even the Play Store installs an app on a device with the help of an APK file.
How does APK installation work?
The process differs slightly when you directly download an APK from platforms like APKPure and APKMirror.
Just as it happens on the Google Play Store, you have to first download the APK file. However, the installation process doesn’t happen automatically once the download is complete. Users have to open the APK file and manually start the installation process. Once the installation is complete, users can proceed to use the app normally.
Can you delete the APK file after installation? Yes. Deleting the APK file will have no bearing on the working of the app after installation. Users will have to manually delete the APK from their device. Unlike app downloads from the Play Store, there is no automatic deletion of APK files after installation.
This brings us to an interesting question. Is it safe to download APK files from sources besides the Play Store?
Downloading popular apps can be considered safe because most APK stores import app files and listings from the Play Store. Do not download unsolicited or untested apps through APKs. It is best to go through the Play Store in general because every app build submitted on the platform goes through some level of malware testing.
Why should you learn about APK files while using mobile app builders?
The option of using an online app builder to create an app is no longer considered a left field decision. Learning how to create an app is not viable for everyone out there. It thus makes sense to use DIY app builders and automate the whole process.
No-code app builders however also make it inessential for people to learn about some technicalities of mobile apps. APKs belong to a similar domain.
For instance, someone using an DIY-builder to make an Android app for a shopify website would only look at APKs as a means to submit the app to the Play Store. What is then the point of learning about the various contents of an APK file?
When users launch an app, they become stakeholders in the mobile app market. It doesn’t matter then if they’ve used app builders or code. They must know and understand their market well.
Google recently launched AABs to compress the size of the files users have to download from the Play Store. AABs essentially defer APK creation to the Play Store and increase the speed of app installs.
Someone who doesn’t care to know about these technicalities will miss out on using AABs. This will cause longer installation times, higher app churn, and other associated problems. Thus, it makes perfect sense to know the essentials of the mobile app market. Knowledge of APK files comes under the same umbrella.
APKs are an essential tenet in the world of Android apps. This piece seeks to shed light on some of the technicalities of APK files. Readers can learn about the contents of APK files and the different sections within them.
The latter sections provide more practical insights into the process of app installation. The penultimate section describes the importance of learning the essentials of APK files for those using mobile app builders.