如何在没有 root 访问权限的情况下获取已安装应用的 APK? [英] How do I get the APK of an installed app without root access?

查看:71
本文介绍了如何在没有 root 访问权限的情况下获取已安装应用的 APK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在没有 root 权限的情况下提取已安装的 Android 应用的 APK 文件.

I'm trying to extract the APK file of an installed Android app WITHOUT root permissions.

我认为这是不可能的,因为非系统应用程序的所有 APK 文件都位于/data/app 中,并且访问此文件夹需要 root 权限.然后我发现 Google Play 商店中有许多应用似乎可以访问 APK 文件,即使在非 root 设备上也是如此.

I thought that this was impossible, because all APK files for non-system-apps are located in /data/app, and accessing this folder requires root permission. Then I found that there are numerous apps in the Google Play store that seem to have access to the APK files even on non-rooted devices.

谁能告诉我这怎么可能?有没有不用root就可以备份APK文件的备份软件?

Can someone tell me how this is possible? Aren't there backup apps which backup the APK files without root?

推荐答案

无需root权限即可访问/data/app;该目录的权限是 rwxrwx--x.目录的执行权限意味着您可以访问它,但是缺少读取权限意味着您无法获得其内容列表——因此为了访问它,您必须知道您将要访问的文件的名称.Android 的包管理器会告诉您存储的给定包的 apk 的名称.

Accessing /data/app is possible without root permission; the permissions on that directory are rwxrwx--x. Execute permission on a directory means you can access it, however lack of read permission means you cannot obtain a listing of its contents -- so in order to access it you must know the name of the file that you will be accessing. Android's package manager will tell you the name of the stored apk for a given package.

要从命令行执行此操作,请使用 adb shell pm list packages 获取已安装包的列表并找到所需的包.

To do this from the command line, use adb shell pm list packages to get the list of installed packages and find the desired package.

通过包名,我们可以使用adb shell pm path your-package-name获取APK的实际文件名和位置.

With the package name, we can get the actual file name and location of the APK using adb shell pm path your-package-name.

并且知道完整目录,我们最终可以使用 adb pull full/directory/of/the.apk

And knowing the full directory, we can finally pull the adb using adb pull full/directory/of/the.apk

感谢@tarn 指出在 Lollipop 下,apk 路径将是 /data/app/your-package-name-1/base.apk

Credit to @tarn for pointing out that under Lollipop, the apk path will be /data/app/your-package-name-1/base.apk

这篇关于如何在没有 root 访问权限的情况下获取已安装应用的 APK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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