Android is built on a Linux kernel and an advanced, optimized virtual machine for its Java applications. Both technologies are crucial to Android. The Linux kernel component of the Android stack promises agility and portability to take advantage of numerous hardware options for future Android-equipped phones. Android's Java environment is key: it makes Android very accessible to programmers because of both the number of Java software developers and the rich environment that Java programming has to offer. Mobile platforms that have relied on less-accessible programming environments have seen stunted adoption because of a lack of applications as developers have shied away from the platform. BUILDING ON THE LINUX KERNEL
Why use Linux for a phone? Using a full-featured platform such as the Linux kernel provides tremendous power and capabilities for Android. Using an open source foundation unleashes the capabilities of talented individuals and companies to move the platform forward. This is particularly important in the world of mobile devices, where products change so rapidly. The rate of change in the mobile market makes the general computer market look slow and plodding. And, of course, the Linux kernel is a proven core platform. Reliability is more important than performance when it comes to a mobile phone, because voice communication is the primary use of a phone. All mobile phone users, whether buying for personal use or for a business, demand voice reliability, but they still want cool data features and will purchase a device based on those features. Linux can help meet this requirement.
Speaking to the rapid rate of phone turnover and accessories hitting the market, another advantage of using Linux as the foundation of the Android platform stack is that it provides a hardware abstraction layer, letting the upper levels remain unchanged despite changes in the underlying hardware. Of course, good coding practices demand that user applications fail gracefully in the event a resource is not available, such as a camera not being present in a particular handset model. As new accessories appear on the market, drivers can be written at the Linux level to provide support, just as on other Linux platforms.
User applications, as well as core Android applications, are written in the Java programming language and are compiled into byte codes. Byte codes are interpreted at runtime by an interpreter known as a virtual machine. RUNNING IN THE DALVIK VIRTUAL MACHINE
The Dalvik virtual machine is an example of the needs of efficiency, the desire for a rich programming environment, and even some intellectual property constraints colliding, with innovation as a result. Android's Java environment provides a rich application platform and is very accessible because of the popularity of the Java language itself. Also, application performance, particularly in a low-memory setting such as is found in a mobile phone, is paramount for the mobile market. However this is not the only issue at hand.
Android is not a J2ME platform. Without commenting on whether this is ultimately good or bad for Android, there are other forces at play here. There is a matter ofJava virtual machine licensing from Sun Microsystems. From a very high level, Android's code environment is Java. Applications are written in Java, which is compiled to Java bytecodes and subsequently translated to a similar but different representation called dex files. These files are logically equivalent to Java bytecodes, but they permit Android to run its applications in its own virtual machine that is both (arguably) free from Sun's licensing clutches and an open platform upon which Google, and potentially the open source community, can improve as necessary.
NOTE It is too early to tell whether there will be a big battle between the Open Handset Alliance and Sun over the use of Java in Android. From the mobile application developer's perspective, Android is a Java environment; however, the runtime is not strictly a Java virtual machine. This accounts for the incompatibilities between Android and "proper" Java environments and libraries.
The important things to know about the Dalvik virtual machine are that Android applications run inside it and that it relies on the Linux kernel for services such as process, memory, and filesystem management.
After this discussion of the foundational technologies in Android, it is time to focus on Android application development. The remainder of this chapter discusses high-level Android application architecture and introduces a simple Android application. If you are not comfortable or ready to begin coding, you might want to jump to chapter 2, where we introduce the development environment step by step.
Was this article helpful?