Android Studio, SDK and NDK on Linux laptop

In recent days, I installed the Android Studio, Android SDK and Android NDK on my Linux laptop named ‘Klystron’. Rather arbitrarily, I decided not to reinstall my Android-building capabilities on the Windows 7 Desktop ‘Mithral’, which were based on the antiquated practice of using Eclipse to build Android apps. It continues in the same vane it started in, with SDK updates.

But the approach of using Android Studio on the laptop suits me, instead of setting up Eclipse in this way again.

Also, I have had to install JDK 8 on the laptop, which under Debian / Jessie means we have to resort to backports. But that was a straightforward task to accomplish.



Android Permissions Control

One fact which I had written about before, was that Android differs from Linux, in that under Android, every installed app has its own username. Also, because different users installed a different set of apps in different order, the UID – an actual number – for any given username will be different from one device to the next. And then I also wrote, that a username belonging to a group or not so, can be used to manage access control, just like under Linux.

There is a reason for which things are not so simple with Android. Most Android apps are written in a language named “Dalvik”, the source code of which has syntax identical to “Java”, and which must be compiled into “Bytecode”. The bytecode in turn runs on a bytecode interpreter, which is also referred to as a Virtual Machine.

The reason for which this affects permissions, is because as far as the kernel can see, this VM itself runs under one username. This is similar to how a Java VM would run under one username. And so a much more complex security model is put in place by the VM itself, because presumably this VM’s username has far-reaching capabilities on the device.

The actual use of groups to control access under Android is simpler, and applies at first glance to processes which have been compiled with the ‘NDK’ – with the “Native Development Kit” – and which therefore run directly, say from C++ source code.

Further, the Dalvik VM is capable of reading the permissions of actual files, and is capable of applying its own security model, in a way that takes the permission bits into account, that have been assigned to the files by the Linux kernel. So for most purposes, the security model on the VM is more important than the actual permission bits, as assigned and implemented by the kernel, because most Android source code is effectively written in a Java-like language.