I am trying to understand the process of how an apk is installed on Android, specifically the Android SDK emulator via adb install (where i am testing).
In searching I have found no satisfactory answer outside of "the apk is simply copied to /data/app and is installed when you run it. This is not satisfactory to me as it does not explain how the apk's icon appears on the menu amongst other issues.
Coming from a Windows background, running an .exe or installer to install a program modifies registries, files, services, etc.... I need to understand if this or something similar occurrs when an apk is installed on Android.
So if anyone can explain to me what occurrs specifically when an apk is installed on Android I would greatly appreciate it.
On a side note I would also like to know if the Dalvik VM "zygote
" is involved in the installation or does it occur at the lower linux kernel level?
My ultimate goal here is to use strace to caputer the installation process of an apk to document system modifications, file creations, network activity and other events of interest.
Android 8 or aboveOn your device, tap Settings > Apps. Tap Special access > Install unknown apps. Tap the browser from where you will download the APK, such as Chrome. If prompted, toggle Allow from this source on.
If you've ever installed an Android application from the Google Play store, then you've used an APK file without realizing it. When you tap the Install button, Google Play automates the process of transferring the APK file to your phone and running it for you.
The APK extension stands for Android Package Kit, and is the file format used for installing Android applications (much like EXE for Windows). If you want to install an app from outside the Google Play Store (a process known as 'sideloading') you'll need to download and run the APK manually.
Corrupted storage, especially corrupted SD cards, is one of the most common reasons why Android app not installed error occurs. Unwanted data might contain elements that disturb the storage location, causing Android app can't install error.
There are mainly two categories of Android applications.
Following are the step by step installation process.
XML parsing, resource analysis, and .apk file copying are done by
PackageManageService.java
however, directory creation is done by
installd.c
PackageManageService.java communicates with installd.c via a local socket, located at /dev/socket/installed
Package where .apk file got copied is different for system apps and user apps. for system apps it is
/system/app/
Where as for user app .apk file copied in to .apk file is copied to
/data/app
.dex file, which is extracted from the .apk file, is copied to /data/dalvik-cache/.
Package Manager creates data directory /data/data// to store database, shared preference, native library and cache data
Everything that you want to know, I think, is in the Android develeper website http://developer.android.com/tools/building/index.html and to understand packaging of the app itself, here is the image better (it's not the APK installation process, but it can help you understand the apk structure and instalation). You can also google about aapt tool and .dex to understand more because classes.dex is the substruction of your application - contains the java and classes compiled. One dex file contains multiple classes as opposed to java class file which contain only that one class. dex file is java bytecode converted with DX tool which is integral part of Android SDK. As a result of that, it allows every application to run as its own process with its own instance of the Dalvik virtual machine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With