Skip to content

How Android Works

Normally You will write your android application in either Java or Kotlin. However these days there are several frameworks like Xamarin, Flutter and React Native but Java and Kotlin are the two native languages.

Once you've written your app, the Android SDK tools will compile the code, data and resource files into an APK (Android package).

In most cases a single APK file will contain all the content of the app.

Each Android App normally runs on its own virtual machine(VM). This implies that the app can run in isolation from other apps.

Android system applies the principle of least privilege. This means that each app will only have access to the components it requires to do its work,and no more.

However, there are ways for an app to share data with other apps, such as by sharing Linux user id between app, or apps can request permission to access device data like SD card, contacts etc.

Android ART Runtime

Android 5.0(Lollipop) and above have been using ART as the main runtime.

ART was introduced experimentally in Android 4.4 KitKat.

Before ART Runtime was DVM(Dalvik Runtime).

ART runtime utilizes AOT(Ahead Of Time) compilation. This compilation model involves optimizing application performance on startup and application execution.

DVM utilizes JIT(Just In Time) compilation model. However, with AOT dex files are compiled during installation.

This compilation is done using the dex2oat tool.

Advantages of AOT Compilation

No. Advantage
1. Removal of delay introduced by JIT compilation during each application execution.This is because Dex2oat will generate system-dependent code for the device it's run on.
2. Reduction in number of processor cycles used by the application.This is because AOT will remove the time the JIT compiler normally uses to convert code into machine format.
3. Reduction in battery power consumption.This is because of the reasons listed above.
4. Improvements in Garbage Collection and memory allocation.This results in more responsive applications.

Disadvantages of AOT compilation

No. Disadvantage
1. Larger memory footprint than JIT and DVM

Android Licensing

Android, we said is an open source mobile software environment. It's built on top of Linux kernel.

Android is released under two different open source licenses:

No. License Description
1. GNU General Public License(GPL) This is because Linux kernel this license is a requrement for anyone licensing the Linux kernel like android does.
2. Apache Software License(ASL) This excludes the kernel.

Both licenses encourage the open source spirit.

However Apache license is friendlier towards commercialization. It endeavors to balance the "opensourceness" with commerical market forces.