Reputation: 695
Exactly where inside the data/data/myapp/... is executable code stored? And how is it stored, is it stored as dex code?
Upvotes: 3
Views: 4304
Reputation: 10062
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]
Upvotes: 4
Reputation: 29285
Where?
System preset apps are in /system/app
. Ordinary apps are in /data/app
. They are stored as .apk
files which are of type simple ZIP files. .dex
files also can be accessed by unzipping them. The name of that .dex
file is classes.dex
.
How?
Whenever you install a new app, Android simplely copy that APK file there. Moreover, in ART, Android also compiles application byte codes to native device codes and save these codes somewhere.
Unlike Dalvik, ART introduces the use of ahead-of-time (AOT) compilation by compiling entire applications into native machine code upon their installation.
How can I access there?
By ADB (Android Debug Bridge) you can access Android file system.
Upvotes: 1