【问题标题】:How some apk are stored by AndroidAndroid如何存储一些apk
【发布时间】:2013-05-02 12:13:25
【问题描述】:

我知道 apk 以包的名称存储在 /data/app 中(最后是“-1”)。

在非 root 手机上无法列出 (ls) /data/app 中包含的文件,但是由于我知道文件名,我可以将 apk 从 /data/app 复制到 /mnt/sdcard/whereeveriwant/,即使没有root权限。

public static void copyFile(String inputPath, String inputFile, String outputPath) {
InputStream in = null;
OutputStream out = null;
try {
    //create output directory if it doesn't exist
    File dir = new File (outputPath); 
    if (!dir.exists()) { dir.mkdirs(); }
    in = new FileInputStream(inputPath + inputFile);        
    out = new FileOutputStream(outputPath + inputFile);
    byte[] buffer = new byte[1024];
    int read;
    while ((read = in.read(buffer)) != -1) {
        out.write(buffer, 0, read);
    }
    in.close();
    in = null;
    out.flush();
    out.close();
    out = null;        
}  catch (FileNotFoundException fnfe1) {
    Log.e("copy", fnfe1.getMessage());
} catch (Exception e) {
    Log.e("copy", e.getMessage());
}
}
copyFile(
        "/data/app/", "com.myawesomeapp.android-1.apk",
        Environment.getExternalStorageDirectory() + File.separator + folder + File.separator
);

但是对于某些应用程序(据我所知不是免费应用程序),此方法不起作用。 apk 有不同的名称吗?还是前向锁定?

这是一个研究问题,没有实际用途。

【问题讨论】:

  • 试试/system/app目录。
  • 我试过了,但它不起作用。无论如何,我相信 /system/app 仅包含系统应用程序,例如 Contacts.apk 和 Calculator.apk
  • 您可以使用 'adb shell pm list package -f' 列出所有已安装的应用程序,包括包名和 apk 位置。
  • 我不知道这个命令,它对我帮助很大。付费应用保存在 /mnt/asec/

标签: android security apk


【解决方案1】:

好的,我明白了:免费应用程序被解密,APK 最终在 /data/app 中,而 /data/app-asec 中的加密容器被创建并安装在 /mnt/asec/package.name 下用于付费应用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-16
    • 2012-02-03
    • 1970-01-01
    • 2015-05-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多