The Android ecosystem is constantly expanding, with new frameworks and resources being made available every day that are intended to speed up development and make our jobs as developers easier.
In this multipart series, you’ll learn all about the Android development ecosystem following our Android Developer Roadmap, providing you with a more holistic perspective of the Android community and how you may improve as a developer. The Android Developer Roadmap offers suggested study pathways along the way to help you comprehend the ideas, and it is created to provide you with a thorough understanding of the existing Android environment.
The first four elements of the Android Roadmap will be covered in part one of this series:
- Android OS
- The Android Platform
- App Manifest
The list presents an overview of the topics that need to be covered to help you being your journey in Android programming. Do skip ahead to the section of the roadmap that resonates with part of your journey.
Android Programming Languages
All Android applications must be created in Kotlin, Java, or C/C++. The two main programming languages used by Android developers are Kotlin and Java, whereas C++ is used to create hardware- or performance-based features that employ the Java Native Interface (JNI) to invoke native functions.
Let's start with understanding how Kotlin and Java support you in your programming journey.
Java was chosen as the primary language for Android application development when Google unveiled the first version of their Android OS more than ten years ago. Since Java is one of the first object-oriented programming languages, it is simple to learn and compatible with practically any device and operating system thanks to the Dalvik Virtual Machine (DVM), which was inspired by the Java Virtual Machine (JVM). Java was therefore one of the best languages to use when Google started developing the Android system.
Kotlin was born from JetBrains. It blends functional and object-oriented programming and was initially created for the JVM environment. Since its introduction, Kotlin has gained popularity in a variety of industries, including Android development.
Here are a few reasons why Kotlin pairs so well with Android:
- Interoperability: Kotlin is 100% interoperable with Java and supports great interoperability with JVM environments.
- Safety: Android apps that contain Kotlin code are 20% less likely to crash according to the Android docs.
- Asynchronous: Kotlin’s use of coroutines allows it to provide asynchronous (non-blocking) programming support.
Together with the previously mentioned topics, Google also revealed their Kotlin-first strategy for Android development at Google I/O 2019. The quantity of Kotlin-built applications has multiplied since the announcement.
Kotlin would be an excellent choice if you wanted to start learning Android development right now.
Android Operating Systems
The Linux kernel, which serves as the basis of the Android platform, enables Android to benefit from certain security measures. Since the Linux kernel's inception in 1991, which is used in millions of security-sensitive systems, it has undergone continuous research, testing, and improvement by thousands of people.
The Android documentation claims that Android makes use of a number of important Linux security technologies, including:
- A user-based permissions model
- Process isolation
- An extensible mechanism for secure inter-process communication (IPC)
- The ability to remove unnecessary and/or insecure parts of the kernel
Linux also has a multiuser operating system that enables several users to access separate system resources like RAM, CPU resources, and applications. They can be safeguarded from one another by isolating user resources from one another.
With its own Application Sandbox, the Android platform leverages the Linux multiuser system to secure apps and the system against malicious programs while isolating resources from one another.
Android Platform Architecture
Android platform architecture consists of six layers built on top of the Linux Kernel. (Note: The actual architecture is stacked in the reverse order of the figure above.)
Let’s discuss each layer:
The Linux Kernel
The foundation of the Android platform architecture is the Linux Kernel. With its Low Memory Killer Daemon, it controls low-level memory as well as all of the device drivers that are available, including the Bluetooth, WiFi, camera, audio, display, and peripheral drivers.
Hardware Abstraction Layer (HAL)
Implementing low-level functionality without changing higher-level systems is possible thanks to the hardware abstraction layer (HAL), which creates a bridge between hardware capabilities and the Java API Framework.
HAL implementations are bundled into modules, which are kept as shared libraries (.so files) and loaded by the Android operating system when necessary.
One of the key components of the Android ecosystem is the Android Runtime (ART), an application runtime system used by the Android OS. For smartphones running Android 5.0 (Lollipop) or higher, the ART virtual machine was created to take the place of the Dalvik virtual machine.
By converting DEX bytecode into machine code that your system can comprehend, ART's primary function is to execute the Dalvik Executable format (DEX).
Several virtual machines can be run on low-memory devices thanks to the ART architecture. Some important characteristics have a direct impact on how quickly Android applications operate. Important characteristics of ART include:
- Ahead-of-time (AOT) and just-in-time (JIT) compilation
- Enhanced garbage collection (GC)
- Converting an app package’s DEX files to condensed machine code (on Android 9 (API level 28+))
- Better debugging support, including detailed diagnostics and crash reporting, the ability to set multiple watchpoints, and more
Java API Framework (Application Framework)
The whole feature set of the Android OS is provided by the Java API framework, which is a collection of Java and Kotlin libraries for Android. The extensible View System, reusable parts, and system managers found in the Android APIs are utilized to construct Android applications by making interface reuse easier.
Android Jetpack, promoted by Google, is one of the Java API framework's more potent APIs. By minimizing boilerplate code, Jetpack quickens development so that developers may concentrate on the code they care about.
It additionally offers solutions for Lifecycle, UI toolkit, Navigation, Security, Caching, Scheduler, Dependency Injection, and many other things. This will be thoroughly covered in next posts.
System apps are pre-installed applications that are found in the system partition alongside your ROM and include things like email, SNS messaging, calendars, internet browsing, contacts, and more. Depending on the manufacturer of the mobile phone, the System Apps configuration may change.
Every Android project must have an AndroidManifest.xml file which describes essential information about the application such as the package name, entry points, components, permissions, and metadata.
Package Name and Application ID
Every Android project must have a package attribute, which represents your application’s universally unique application ID in the AndroidManifest.xml file. The manifest file must be located in your /src/main folder.
On the Android operating system (on a physical device) and in Google Play, only the package attribute offers a guarantee for application identification. The package attribute is used in the following situations by the Android development tools:
- Applying the package name as the namespace for your app resources.
- Resolving implicit class names that are declared in the manifest file. For example, with the above manifest, an activity declared as <activity android:name=".MainActivity"> is resolved to be io.getstream.chat.android.ui.MainActivity. So the classes also must be in the same package folder.
The Android Development Roadmap Part 1 has come to an end. You may have a better understanding of the inner workings of Android applications because this part discussed key points concerning Android's architecture.
Remember, don't let the volume of details on this plan frighten you. In order to grasp Android development, look over the sections that would be most useful to you.
The Android operating system is not something you have to become an expert in. To design better Android applications, you will undoubtedly benefit from understanding the architecture of the Android platform as a whole.