android - 我们可以在 apk 文件中 bundle 一个目录吗?

标签 android

我有一个包含一些文件的目录。我想将这个目录 bundle 在 apk 文件中,这样当我安装 apk 文件时,该目录就会被复制到 android 设备上的特定位置。

因为我在 developer.android.com 上找不到此信息,所以我可以在 apk 文件中 bundle 一个目录吗?我需要为此修改任何配置文件吗?

谢谢.. 阿杰

最佳答案

你不能,但你可以看看 android assets 文件夹,

http://developer.android.com/guide/topics/resources/providing-resources.html

Assets是原始资源,不会被android编译器压缩。

来自开发者网站:

Assets /

This is empty. You can use it to store raw asset files. Files that you save here are compiled into an .apk file as-is, and the original filename is preserved. You can navigate this directory in the same way as a typical file system using URIs and read files as a stream of bytes using the the AssetManager. For example, this is a good location for textures and game data.

关于android - 我们可以在 apk 文件中 bundle 一个目录吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12913363/

相关文章:

android - JaCoCo Gradle - 排除类并覆盖包含

android - 在 Android 模拟器上重新部署时避免登录

Android数据绑定(bind),无法生成 View 绑定(bind)

android - BroadcastReceiver 收不到本地广播

android - 我如何启动在 Android 上运行 logcat 的进程?

Android:在 fragment 内使用 GLSurfaceView

android - 如何在安卓模拟器中为印度地方语言设置自定义语言环境

Android Button Alpha 在 2.2 及更低版本上看起来很奇怪

java - 返回图像资源 ID

Android 2.1 gallery 不向下兼容 Cupcake 版本,现在怎么办?