Android: Understanding the APK installation process

后端 未结 3 911
暗喜
暗喜 2020-12-22 16:57

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

3条回答
  •  -上瘾入骨i
    2020-12-22 17:27

    There are mainly two categories of Android applications.

    1. System Apps: installed when system is initialized
    2. User Apps: installed from Play store, using ADB or copying .apk file in SD card.

    Following are the step by step installation process.

    1. AndroidManifest.xml is parsed, information is extracted and stored into /data/system/packages.xml and /data/system/packages.list
    2. .apk file is copied to a specific directory and a directory for data storage is created for this app

    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

提交回复
热议问题