1

I want to know how the APK installing in Android exactly works. E.g. a downloaded APK is installed when I press 'install' but there is some process, right? I want to know that.

Inside the APK of the game called Mini Militia I found there are three folders inside the assets folder: HD, HDR and SD. The APK installs one of those according to the phone's resolution maybe, I don't know. I edited some files in the HD folder but my phone installs the files from HDR. My mobile is a OnePlus One. I want to know if I could change that.

0

1 Answer 1

3

In Android versions <= 4.4 (KitKat and older) the APK file is simply copied into /data/app folder, a cache file is generated for it and installed on the cache partition. When Android is booting, it checks if cache files for any APKs are missing and generates them if necessary. And that's it.

In newer Android versions (>= 5.0 so Lollipop and newer) it's a bit more complicated because of the new ART virtual machine. A new folder is created in /data/app for every app and the APK is placed there. Libraries are extracted from APK into /data/app/<app_folder>/lib and code is piped through ART's ahead-of-time compiler. That's why installing apps takes much longer in ART-based Androids.

Other files aren't extracted from the APK unless the app itself does it.

You must log in to answer this question.