Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How and where is Application executable code stored inside a device?

Tags:

android

Exactly where inside the data/data/myapp/... is executable code stored? And how is it stored, is it stored as dex code?

like image 781
Felipe Calderon Avatar asked Jul 04 '26 16:07

Felipe Calderon


1 Answers

Starting with

where

Connect to your device with adb and the run pm path here-goes-package-name command. Like this:

$ adb shell
root@vbox86p:/ # pm path pl.pelotasplus.wptv
package:/data/app/pl.pelotasplus.wptv-1/base.apk

This will be a path to .apk on your device.

Some apps, like system apps, are in /system/app directory or even /system/priv-app/.

root@vbox86p:/data # pm path com.google.android.partnersetup
package:/system/priv-app/GooglePartnerSetup/GooglePartnerSetup.apk

and answering second part of your question

how

They are just .apk files, which are basically a ZIP files. So if you use unzip -l command you will see that the code of your app is kept in .dex file inside above mentioned .apk file

root@vbox86p:/data # unzip -l /system/priv-app/GooglePartnerSetup/GooglePartnerSetup.apk | grep .dex   <
276104  08-21-08 17:13   classes.dex

Sometimes there can be more than one .dex files -- welcome to the Multi-Dex world!

cache

There is also something called dalvik cache, where .dex files are kept for performance reasons.

root@vbox86p:/ # ls -al ./data/dalvik-cache/x86/data@[email protected]@[email protected]
rw-r--r-- system   all_a102  4690352 2015-05-31 20:17 data@[email protected]@[email protected]
like image 147
pelotasplus Avatar answered Jul 07 '26 05:07

pelotasplus