Android /data/app directory

No, static resource files like image assets are not directly copied to a general /data/app directory. Instead, they are embedded within the app's APK (or AAB) file, which is a package that gets installed in the /data/app location, and are accessed by the app at runtime from their bundled location or via asset delivery mechanisms. The Android system handles the unpacking and access of these resources when the app is installed and launched.

How Resources Are Bundled and Accessed

  • Bundled in APK/AAB:

When you build an Android app, the image assets, along with other resources like layouts and strings, are placed into a specially structured resource directory (like res/drawable) and then compiled into the app's APK (Android Package) or AAB (Android App Bundle) file.

  • Installation:

During installation, the Android system installs the entire APK/AAB to a dedicated directory for that app under /data/app.

  • Runtime Access:

At runtime, your app doesn't need to access a separate location for these static resources. The Android system provides APIs that allow the app to load these resources directly from within its own packaged structure.

Special Cases

  • Asset Delivery: For very large assets that would significantly increase the initial app download size, Google Play offers asset delivery mechanisms like:

@cubewhy

what do you mean installation files

In Adobe AIR you can do things like:

const file:File = new File("app://scenary/waterfall.png");
file.addEventListener("complete", function(e:Event):void {
    trace(file.data); // [object ByteArray]
});
file.load();

The app project would have this typically:

  • scenary
    • waterfall.png
  • src
    • AS3/MXML stuff
  • application.xml (AIR app descriptor)
  • asconfig.json (AS3 and some AIR configuration)

asconfig.json instructs the adt -package and adl (dev launcher) commands so that the app will embed scenary/waterfall.png, but not "statically" into the ActionScript 3 runtime lifetime (RAM), but rather in the app's installation directory.

In Windows this scenary/waterfall.png file would typically get in the same directory as the executable's.


Android is just copying the provided apk to /data/app/<base64>/<pkg>-<base64>/base.apk to install an application.

I see. Probably I'll have to bind to some Java API for accessing resource files from the .apk.

I'm aware of Dalvik (DEX), but it's mostly a worry when doing Rust bindings stuff.