android从Marketplace安装应用程序后,是否保留。apk文件?
Android是否有一个保存这些文件的标准位置?
android从Marketplace安装应用程序后,是否保留。apk文件?
Android是否有一个保存这些文件的标准位置?
当前回答
预安装的应用程序通常在/system/app中,用户安装的应用程序在/data/app中。
你可以使用“adb pull”,但是你需要知道APK文件的完整路径。在模拟器上,您可以使用"adb shell" + "ls"获得目录列表。但在android设备上,由于安全原因,您将无法在“/data”文件夹中这样做。那么如何找出APK文件的完整路径呢?
你可以通过编写一个查询PackageManager的程序来获得所有已安装应用程序的完整列表。下面是简短的代码片段:
PackageManager pm = getPackageManager();
List<PackageInfo> pkginfo_list = pm.getInstalledPackages(PackageManager.GET_ACTIVITIES);
List<ApplicationInfo> appinfo_list = pm.getInstalledApplications(0);
for (int x=0; x < pkginfo_list.size(); x++){
PackageInfo pkginfo = pkginfo_list.get(x);
pkg_path[x] = appinfo_list.get(x).publicSourceDir; //store package path in array
}
你也可以找到提供这类信息的应用程序。他们有很多。试试这个(AppSender)。
其他回答
在/data/app中,但出于复制保护,我认为你不能访问它。
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中使用它。
我来这篇文章是因为我想重新安装一些我很喜欢的应用程序。 如果这是你的情况,只要去谷歌播放,然后找到我的应用程序,标签全部,你会找到一种方法重新安装你喜欢的应用程序。我遇到了一个问题,我无法通过搜索一个应用程序找到,但它在我的应用程序中,所以我可以重新安装到我的新手机;)
你可以用ADB拉应用。它们应该在/data/App/中。
adb pull (location on device) (where to save)
请注意,你必须根你的手机拉复制保护的应用程序。
你可以在adb shell上使用包管理器(pm)来列出包:
adb shell pm list packages | sort
要显示.apk文件的位置:
adb shell pm path com.king.candycrushsaga
package:/data/app/com.king.candycrushsaga-1/base.apk
和adb拉来下载apk。
adb pull data/app/com.king.candycrushsaga-1/base.apk