如何从 Android 设备获取 apk 文件?
如何从 Android 设备获取 apk 文件?或者如何将 apk 文件从设备传输到系统?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
如何从 Android 设备获取 apk 文件?或者如何将 apk 文件从设备传输到系统?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(26)
这些建议对我来说都不起作用,因为 Android 会在包名称后附加一个序列号以生成最终的 APK 文件名。在更新版本的 Android(Oreo 和 Pie)上,会附加不可预测的随机字符串。以下命令序列在非 root 设备上对我有用:
您已经知道包名称。
查看包名称列表,并尝试查找相关应用程序与包名称之间的匹配项。这通常很简单,但请注意,包名称可能与应用程序名称完全无关。如果您无法从软件包名称列表中识别该应用程序,请尝试使用浏览器在 Google Play 中查找该应用程序。 Google Play 中应用程序的 URL 包含包名称。
获取所需包的 APK 文件的完整路径名。
输出将类似于
包:/data/app/com.example.someapp-2.apk
或
package:/data/app/com.example.someapp-nfFSVxn_CTafgra3Fr_rXQ==/base.apk
使用步骤 2 中的完整路径名,将 APK 文件从 Android 设备拉取到开发环境框。
None of these suggestions worked for me, because Android was appending a sequence number to the package name to produce the final APK file name. On more recent versions of Android (Oreo and Pie), an unpredictable random string is appended. The following sequence of commands is what worked for me on a non-rooted device:
you already know the package name.
Look through the list of package names and try to find a match between the app in question and the package name. This is usually easy, but note that the package name can be completely unrelated to the app name. If you can't recognize the app from the list of package names, try finding the app in Google Play using a browser. The URL for an app in Google Play contains the package name.
Get the full path name of the APK file for the desired package.
The output will look something like
package:/data/app/com.example.someapp-2.apk
or
package:/data/app/com.example.someapp-nfFSVxn_CTafgra3Fr_rXQ==/base.apk
Using the full path name from Step 2, pull the APK file from the Android device to the development box.
使用 adb。当设备通过 USB 连接时,使用 adb pull 您可以将文件从设备复制到系统。
当然,您还需要正确的权限才能访问文件所在的目录。如果没有,您将需要先root设备。
如果您发现许多 APK 名为“base.apk”,您还可以使用这一行命令从您可以访问的手机中提取所有 APK,同时将任何“base.apk”名称重命名为软件包名称。这还修复了名称后带有看似随机字符的 APK 路径的目录未找到问题:
如果您收到“adb:错误:无法统计远程对象”,则表明您没有所需的权限。我在未root的Moto Z2上运行了这个程序,并且能够下载除youtube之外的所有我未卸载的APK(见下文)。
Use adb. With adb pull you can copy files from your device to your system, when the device is attached with USB.
Of course you also need the right permissions to access the directory your file is in. If not, you will need to root the device first.
If you find that many of the APKs are named "base.apk" you can also use this one line command to pull all the APKs off a phone you can access while renaming any "base.apk" names to the package name. This also fixes the directory not found issue for APK paths with seemingly random characters after the name:
If you get "adb: error: failed to stat remote object" that indicates you don't have the needed permissions. I ran this on a NON-rooted Moto Z2 and was able to download ALL the APKs I did not uninstall (see below) except youtube.
不需要root:
此代码将获取带有名称的第3方包路径,以便您可以轻松识别您的APK,
输出将是
现在使用以下代码提取该包:
如果您在
C:>\
中执行上述 cmd,那么您将在那里找到那个包。No root is required:
This code will get 3rd party packages path with the name so you can easily identify your APK
the output will be
now pull that package using below code:
if you executed above cmd in
C:>\
, then you will find that package there.将 APK 从设备下载到桌面的步骤
A) 确保您正在运行(模拟器/真实设备)。要检查,请使用此命令
B) 选择设备中安装的所有可用软件包列表。您可以使用 grep 命令来选择您要下载的特定包。
输出(可用包列表)
C) 从上面的链接复制包(您想要下载的)。在我们的案例中,我选择这个 (com.example.myapplication) 包
输出
D) 最后,从您的(模拟器/真实设备)下载 APK
示例:尝试在本地提取此 CertInstaller.apk 文件机器 ( Mac )
E) 在本地目录中确认
Steps to Download APK from Device to Desktop
A) Make sure that your running (emulator/real Device). To check use this command
B) Select all the available package list installed in your device. You can use grep command to select the specific package you intend to download.
Output (List of available packages )
C) Copy the package (which you like to download) from the above link. Form our case I choose this (com.example.myapplication) package
Output
D) Finally, To download APK from your (emulator/real device)
Example: Trying to pull this CertInstaller.apk file in your local machine ( Mac )
E) Confirm in your local directory
我见过很多解决这个问题的方法,要么你必须root你的手机,要么你必须安装一个应用程序。然后,经过多次谷歌搜索,我得到了这个针对未root/root手机的解决方案。
列出您到目前为止获得的应用程序。
然后你可以选择一个应用程序,例如 twitter
这里重要的是不要设置密码来加密你的备份
这将创建一个名为 backup.ap 的文件,但你仍然可以'打开它。为此,您必须使用 dd 命令再次提取它。
之后,您所要做的就是提取 tar 内容就完成了。
希望它对你们有用
I've seen that many solutions to this problem either you have to root your phone or you have to install an app. Then after much googling I got this solution for non rooted/rooted phones.
To list which apps you got so far.
Then you may select an app, for instance twitter
An important thing here is to not set up a password for encrypt your backup
This is going to create a file named as backup.ap, but you still can't open it. For this you got to extract it again but using the dd command.
After this all you have to do is to extract the tar content and it's done.
Hope it works for you guys
一款适用于所有 Android 版本的衬垫:
One liner which works for all Android versions:
在 2023 年 6 月,使用:
列出软件包名称,然后:
获取软件包。
In June of 2023, use:
to list the package names, then:
to get the package(s).
在unix系统上,你可以尝试这个功能:
android_pull_apk com.android.contacts
adb shell pm 列出软件包
On unix systems, you can try this function:
android_pull_apk com.android.contacts
adb shell pm list packages
尝试这个 liner bash 命令来备份所有应用程序:
该命令源自 Firelord 的脚本。我刚刚将所有 apk 重命名为其包名称,以解决 elcuco 的脚本,即相同的
base.apk
文件在 Android 6.0“Marshmallow”及更高版本上被覆盖。请注意,此命令仅备份第 3 方应用程序,因为我不认为备份内置应用程序有什么意义。但如果您也想备份系统应用程序,只需省略
-3
选项即可。Try this one liner bash command to backup all your apps:
This command is derived from Firelord's script. I just renamed all apks to their package names for solving the issue with elcuco's script, i.e the same
base.apk
file getting overwritten on Android 6.0 "Marshmallow" and above.Note that this command backs up only 3rd party apps, coz I don't see the point of backing up built-in apps. But if you wanna backup system apps too, just omit the
-3
option.完成@Yojimbo的回答,这就是我所做的(仅限Linux/Mac,在Windows上无法开箱即用。 ..也许在 git 的 bash shell 中):
这是丑陋的 bash,但有效:)
编辑:
它不再适用于 AndroidM:所有文件都在另一个目录下命名为“base.apk”。修复起来应该是“微不足道”的。
Completing @Yojimbo 's answer, this is what I did (Linux/Mac only, will not work out of the box on Windows... maybe in git's bash shell):
This is ugly bash, but works :)
EDIT:
It no longer works on AndroidM: all files are named "base.apk" under another dir. Should be "trivial" to fix.
如上所述,您可以通过 adb 中的 pull 命令获取 apk。
既然您正在谈论已安装的应用程序,请继续查看 Android 文件系统的 /data/app 目录。您会在那里找到 APK。
然后使用adb命令 - adb pull /data/data/appname.apk
As said above, you can get the apk by using the pull command in adb.
Since, you are talking about your installed applications, go ahead and look in the /data/app directory of your Android filesystem. You will find the APK's there.
Then use the adb command - adb pull /data/data/appname.apk
在手机上打开您想要从中提取 apk 的应用。
获取当前打开的应用程序:
获取包名称的路径
4.将您获得的路径复制到 sdcard 目录
5.拉出 apk
编辑
如果第 2 步不起作用,请使用以下命令:
Open the app you wish to extract the apk from on your phone.
Get the currently opened app with:
Get the path to the package name
4.Copy the path you got to the sdcard directory
5.Pull the apk
Edit
If step no 2 doesn't work use this:
如果您知道(或者您可以“猜测”)
.apk
的路径(似乎的格式为/data/app/com. example.someapp-{1,2,..}.apk
到 ,然后您也可以从/data/app
复制它,这甚至在我的非 root 上也有效。 只需使用普通的 Android 手机即可(例如这个)并运行:
然后您可以将其从 SD 卡移动到您想要的任何位置(或将其附加到电子邮件等)。与
.apk
文件相关的内容。If you know (or if you can "guess") the path to the
.apk
(it seems to be of the format/data/app/com.example.someapp-{1,2,..}.apk
to , then you can just copy it from/data/app
as well. This worked even on my non-rooted, stock Android phone.Just use a Terminal Emulator app (such as this one) and run:
Then you can move it from the SD-card to wherever you want (or attach it to an email etc). The last bit might be technically optional, but it makes your life a lot easier when trying to do something with the
.apk
file.此处概述的过程不适用于 Android 7 (Nougat) [可能也适用于 Android 6,但我无法验证]。您无法直接在 Nougat 下提取 .apk 文件(除非在 root 模式下,但这需要 root 的手机)。但是,您可以使用 adb shell 将 .apk 复制到手机上的备用路径(例如 /sdcard/Download),然后您可以从备用路径执行 adb pull。
The procedures outlined here do not work for Android 7 (Nougat) [and possibly Android 6, but I'm unable to verify]. You can't pull the .apk files directly under Nougat (unless in root mode, but that requires a rooted phone). But, you can copy the .apk to an alternate path (say /sdcard/Download) on the phone using adb shell, then you can do an adb pull from the alternate path.
对于从设备检索的每个 apk 文件,所有这些答案都需要多个步骤。 1. 确定包名称,2. 找到文件,3. 下载。我构建了一个简单的
apk_grabber
python 脚本 来为任何与给定正则表达式,然后将这些 apk 反编译成 jar 文件。All these answers require multiple steps for each apk file retrieved from the device. 1. determine package name, 2. find the file, and 3. download it. I built a simple
apk_grabber
python script to do this for any app that matches a given regex, and then decompiles those apks into jar files.操作方法如下:
在您的设备中下载并安装 APK Extractor。它是免费的,并且兼容几乎所有 Android 设备。另一个优点是它甚至不需要 root 或任何东西就可以工作。
安装后,启动它。在那里,您将看到设备中的应用程序列表,其中包括您稍后安装的应用程序以及系统应用程序。长按您想要提取的任何应用程序(您可以一次选择多个或所有应用程序),然后单击顶部看到的提取选项。您还可以选择通过蓝牙或消息传递进行共享。
完成后,您将看到提取的应用程序为 AppName_AppPackage_AppVersionName_AppVersionCode.apk,默认保存在路径 /sdcard/ExtractedApks/ 中。
有关如何在android中提取apk文件的详细说明,访问:http://appslova.com/how-to-extract- apk-files-in-android/
Here's how you do it:
Download and install APK Extractor in your device. It is free, and is compatible in almost all of the Android devices. Another plus point is it does not even require root or anything to work.
After you have it installed, launch it. There you will see a list of apps which are in your device, which include the apps you’ve installed later, along with the system apps. Long press any app you want to extract (you can select multiple or all apps at once), and click on the extract option you see in the top. You will also have the option to share via Bluetooth or messaging.
You’re done, you will see the extracted apps as AppName_AppPackage_AppVersionName_AppVersionCode.apk, which will be saved in the path /sdcard/ExtractedApks/ by default.
For detailed description for how to extract apk files in android, visit: http://appslova.com/how-to-extract-apk-files-in-android/
我收到
不存在错误
这是我如何让它工作的
I got a
does not exist error
Here is how I make it works
我没有使用代码从手机中提取 .apk 文件,但我一直在使用软件从手机中提取 .apk 文件,我使用的软件在下面带有 google play 链接:
3.软件数据线
希望可以帮助你。
I haven't used code to pull .apk file from mobile but i have been using software to extract .apk file from mobile and software i have used are below with google play link:
3.Software Data Cable
Hope it helps You.
无需 Root 且无需 ADB 工具的方法。
安装MyAppSharer 应用程序。
No Root and no ADB tools required method.
Install MyAppSharer app from the play store.
我真的很喜欢所有这些答案。
大多数导出和重命名的脚本都是用 Bash 编写的。
我制作了一个小的 Perl 脚本,它具有相同的功能(它应该在 Windows 和 Linux 的 Perl 中都可以工作,仅在 Ubuntu 上进行了测试)。
这使用 ADB: https://developer.android.com/studio/command-line/ adb
download-apk.pl
输出类似于:
I really liked all these answers.
Most scripts to export and rename all of them were written in Bash.
I made a small Perl script which does the same (which should work both in Perl for windows and linux, only tested on Ubuntu).
This uses ADB: https://developer.android.com/studio/command-line/adb
download-apk.pl
The output is something similar to:
想要非常非常舒适的 1 分钟解决方案吗?
只有您这个应用 https://play.google.com/ store/apps/details?id=com.cvinfo.filemanager(来自 Google Play 的智能文件管理器)。
点击“应用程序”,选择一个并点击“备份”。它将最终出现在您的文件系统中的
app_backup
文件夹中;)wanna very, very comfortable 1 minute solution?
just you this app https://play.google.com/store/apps/details?id=com.cvinfo.filemanager (smart file manager from google play).
tap "apps", choose one and tap "backup". it will end up on your file system in
app_backup
folder ;)另一个 bash 脚本(即适用于大多数基于 UNIX 的系统)。基于Pedro Rodrigues 的答案,但稍微更容易使用。
对 Pedro 版本的改进:
adb pull
一直抱怨没有这样的文件或目录
,而adb shell
可以访问该文件。因此我使用了不同的方法,使用临时文件。将其保存到可执行文件:
Yet another bash script (i.e. will work for most unix-based systems). Based on the answer by Pedro Rodrigues, but is slightly easier to use.
Improvements over Pedro's version:
adb pull
kept complaining aboutno such file or directory
whileadb shell
could access the file. Hence I used different approach, with temporary file.Save this to an executable file:
就我个人而言,使用非 root 设备 Samsung Android 13 我更喜欢名为“Apk Extractor”,因为应用程序的使用是一键操作,您将在
内部存储 -> 中提取 APK 文件。下载-> apk-> your_apk.apk
Personally, using the non-rooted device Samsung Android 13 I prefer the open-source 3rd party application named "Apk Extractor" from F-Droid as the application's usage is a one-click action and you would have extracted the APK file in the
Internal storage -> Downloads -> apk -> your_apk.apk
这将对正在寻找非技术性答案的人有所帮助
这是简单的黑客
从 Google Play 商店下载应用程序
App Share/Send Pro
。选择您要发送的应用程序和发送应用程序的方法。我通常使用蓝牙将应用程序发送到我的电脑或其他手机。
This will help for someone who is looking for a non technical answer
This is simple hack
Download the application
App Share/Send Pro
from google play store. Select the app you want to send and method send application.I usually use Bluetooth to send applications to my pc or another phone.
最简单的一种是:
在手机上安装“ShareIt”应用程序。
现在在电脑或其他手机上安装 shareIt 应用程序。
现在,从安装了该应用程序的手机上,打开 ShareIt 并发送。
在其他手机或电脑上,打开 ShareIt 并接收。
Simplest one is:
Install "ShareIt" app on phone.
Now install shareIt app in PC or other phone.
Now from the phone, where the app is installed, open ShareIt and send.
On other phone or PC, open ShareIt and receive.