android从Marketplace安装应用程序后,是否保留。apk文件?
Android是否有一个保存这些文件的标准位置?
android从Marketplace安装应用程序后,是否保留。apk文件?
Android是否有一个保存这些文件的标准位置?
当前回答
从市场安装
安装后是否保留apk是市场的行为。谷歌播放安装后不保留apk。其他第三方市场可能有不同的行为。
从开发/调试工具(adb, eclipse, android studio)安装
当我们从调试工具安装apk时,直接调用adb install或从eclipse/android studio安装apk, apk将被传输(adb push)到一个公共的可读写目录,通常是/data/local/tmp/。之后,工具会使用pm命令进行安装,安装成功后会删除/data/local/tmp/目录下的临时apk。
我们可以从调试输出中获得这些信息,如下所示。
$ adb install bin/TestApplication.apk
3155 KB/s (843375 bytes in 0.260s)
pkg: /data/local/tmp/TestApplication.apk
Success
系统如何保存apk
当然,系统必须将所有apk存储在某个地方。根据apks类型的不同,系统有三个存放apks的位置:
for stock app Those are usually shipped in device by manufacture, including core app for system running and google service, you can find them under directory /system/app and /system/priv-app. user installed app Most of the apks fall into this category. These apks are usually installed from marketplace by users or by adb install without -s option. You can find them under the directory /data/app for a rooted device. app on sdcard If the apk enable its install location in sdcard with android:installLocation="auto" in its manifest, the app can be moved to sdcard from system's app manager menu. These apks are usually located in secure folder of sdcard /mnt/sdcard/asec. Anther way to force the install location to sdcard is using the command adb install -s apk-to-install.apk.
需要注意的是,预装app的文件不再是一个.apk文件。在/system/app或/system/ pve -app目录下有一个文件夹,包含最新的android版本的每个预安装应用程序的文件。
其他回答
使用此命令列出/data/app/下的所有。apks
adb bugreport | grep 'package name="' | grep 'codePath="/data' | cut -d'"' -f4
与所选答案上所写的相反,你不需要root,并且可以获得已安装应用程序的apk,这就是我在我的应用程序上所做的(这里)。例子:
List<PackageInfo> packages=getPackageManager().getInstalledPackages(0);
然后,对于列表中的每一项,您都可以访问packageInfo.applicationInfo。sourceDir,这是已安装应用的APK的完整路径。
安装Total Commander。 在主页面打开已安装的应用程序。
There is no standard location, however you can use the PackageManager to find out about packages and the ApplicationInfo class you can get from there has various information about a particular package: the path to its .apk, the path to its data directory, the path to a resource-only .apk (for forward locked apps), etc. Note that you may or may not have permission to read these directories depending on your relationship with the other app; however, all apps are able to read the resource .apk (which is also the real .apk for non-forward-locked app).
如果你只是在shell中闲逛,目前非前向锁定的应用程序位于/data/app/.apk中。shell用户可以读取特定的.apk,但不能列出目录。在未来的版本中,命名约定将略有改变,所以不要指望它保持不变,但如果您从包管理器中获得.apk的路径,那么您可以在shell中使用它。
如果你只是想获得你之前安装的东西的APK文件,请这样做:
从谷歌Play获取AirDroid 使用AirDroid从您的PC网络浏览器访问您的手机 进入应用程序,选择已安装的应用程序 点击“下载”按钮,从您的手机下载此应用程序的APK版本
您不需要对您的手机进行根操作,不需要使用adb,也不需要编写任何东西。