Android:原始资源是否存储在本地文件系统上? [英] Android: Are raw resources stored locally on the filesystem?

查看:37
本文介绍了Android:原始资源是否存储在本地文件系统上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在分析一个 APK,并在应用程序的/res/raw/目录中看到一组 .txt 资源.在模拟器上安装应用程序后,我希望在/data/data/[app]/files 目录中看到相同的文件,但它们似乎不存在.原始资源存储在哪里?原始资源是否在应用程序运行时在文件系统的其他地方生成?或者当它们被访问时,是从本地 .apk 文件动态获取的吗?谢谢.

I am analyzing an APK, and see a set of .txt resources in the /res/raw/ directory of the application. After installing the application on an emulator, I would expect to see those same files in the /data/data/[app]/files directory, but they do not seem to exist. Where are the raw resources stored? Are raw resources generated at application runtime somewhere else on the filesystem? Or when they are accessed, is it dynamically from the local .apk file? Thanks.

推荐答案

原始资源(实际上,所有资源)都捆绑在 APK 文件中(这包括放置在 assets/ 中的文件),其中这就是为什么您无法使用 File 句柄的原因.APK 文件本身通常位于设备的 system/app 目录中.

Raw resources (and really, all resources) are bundled in the APK file (this includes files placed in assets/), which is why you cannot get to the using File handles. The APK files themselves usually live in the system/app directory of the device.

您提到的内部存储位置 (/data/data/[app]/files) 是使用 Context.openFileInput()Context 创建的文件的位置.openFileOutput()Context.getFilesDir() 放置.

The internal storage location you mentioned (/data/data/[app]/files) is where files created with Context.openFileInput(), Context.openFileOutput(), or Context.getFilesDir() are placed.

HTH

这篇关于Android:原始资源是否存储在本地文件系统上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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