Android:了解APK安装过程 [英] Android: Understanding the APK installation process

查看:26
本文介绍了Android:了解APK安装过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解如何在 Android 上安装 apk 的过程,特别是通过 adb install(我正在测试的地方)安装 Android SDK 模拟器.

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).

在搜索中,除了apk 被简单地复制到/data/app 并在您运行它时安装.这对我来说并不令人满意,因为它没有解释 apk 的图标如何出现在菜单等问题.

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.

来自 Windows 背景,运行 .exe 或安装程序来安装程序会修改注册表、文件、服务等......我需要了解在 Android 上安装 apk 时是否会发生这种情况或类似的情况.

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.

因此,如果有人能向我解释在 Android 上安装 apk 时具体会发生什么,我将不胜感激.

So if anyone can explain to me what occurrs specifically when an apk is installed on Android I would greatly appreciate it.

顺便说一句,我还想知道 Dalvik VM "zygote" 是否参与安装,还是发生在较低的 linux 内核级别?

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?

我的最终目标是使用 strace 捕获 apk 的安装过程,以记录系统修改、文件创建、网络活动和其他感兴趣的事件.

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应用主要有两大类.

There are mainly two categories of Android applications.

  1. 系统应用:在系统初始化时安装
  2. 用户应用:从 Play 商店安装,使用 ADB 或将 .apk 文件复制到 SD 卡中.

以下是逐步安装过程.

  1. AndroidManifest.xml 被解析,信息被提取并存储到/data/system/packages.xml 和/data/system/packages.list
  2. .apk 文件复制到特定目录,并为此应用创建数据存储目录

XML解析、资源分析、.apk文件复制由

XML parsing, resource analysis, and .apk file copying are done by

PackageManageService.java

PackageManageService.java

然而,目录创建是由

已安装.c

PackageManageService.java 通过位于/dev/socket/installed 的本地套接字与 installd.c 通信

PackageManageService.java communicates with installd.c via a local socket, located at /dev/socket/installed

复制 .apk 文件的包对于系统应用程序和用户应用程序是不同的.对于系统应用程序,它是

Package where .apk file got copied is different for system apps and user apps. for system apps it is

/system/app/

/system/app/

复制到 .apk 文件中的用户应用程序 .apk 文件复制到

Where as for user app .apk file copied in to .apk file is copied to

/数据/应用

从 .apk 文件中提取的

.dex 文件被复制到/data/dalvik-cache/.

.dex file, which is extracted from the .apk file, is copied to /data/dalvik-cache/.

Package Manager 创建数据目录/data/data//来存储数据库、共享首选项、本机库和缓存数据

Package Manager creates data directory /data/data// to store database, shared preference, native library and cache data

这篇关于Android:了解APK安装过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆