
Since the release of Android 1.0 in 2008, the Android ecosystem has evolved enormously, but especially in recent years, with the new contributions of the Java language, changes related to terminals and the appearance of new tools. Recommendations and good practices have evolved accordingly.
Evolution of the development suite
In 2008, when Android 1.0 was released, the terminals were much less powerful than today. This first version of Android, based on a Dalvik architecture, met limited memory constraints. Today (and even for some time now) these constraints no longer exist. Android Runtime (ART) has replaced Dalvik, optimizing both the performance of applications and their memory usage. In parallel with this update, the available tools have evolved in the right direction. In 2013 came out Android Studio, which was upgraded at the same time as the rest of the API. From simple code editor with some obscure features that few people really mastered, this application has become a complete suite of development.
Android Studio 1.0:
Android Studio 3.1:
From the start, Android Studio included a profiling tool (TraceViewer) and a memory visualization tool (DDMS). TraceViewer was graphically complex and little used, especially because it was difficult to find, but also difficult to understand. DDMS allowed to see the memory used by the application, but without details and without possibility to see the state of the environment. These two applications are now found in Android Profiler, a tool built into Studio that allows to view the CPU, memory, network and user interactions. All in a clearer interface, simpler, and more able to be taken in hand by less experienced developers. Others will be able to push further their analysis of applications using Android Systrace which provides information on the state of the entire system and not just the monitored application. Very handy for finding the origins of problems during development.
TraceViewer:
Android Profiler. Much more fun to watch and useful:
From Java to Kotlin
These same developers now have the opportunity to use Kotlin in their projects, a language officially supported by Google in 2017 and brings a lot of new features to Java:
null-safety: the compiler differentiates the variables that can be null and those that do not can not
overload
data classes operator : the compiler automatically creates what one may need for classes whose purpose is to contain data (and not necessarily to treat them)
All these novelties make Kotlin a language of highest level than Java, which provides developers with simpler ways to develop their applications but remains optimized to not slow down executions.
Finally, the implementation of ART, instead of Dalvik architecture, has further optimized the performance of Android applications.
All of these enhancements come with changes to the APIs and libraries provided by the Android team.
What’s new in the API
Layouts (used to define the shape of the views of an application) have changed. The layout “ConstraintLayout” introduced last year, should become the new standard to set up the elements of an Android application.
ConstraintLayout in the Android studio layout editor:
Indeed, this new layout allows to set up constraints between the elements of the user interface, similar to the previous standard (RelativeLayout) but with more flexibility, and completely integrated with the layout editor of Android Studio.
To accompany this layout, a new type of view replaces the ListViews, normally used mostly for the elements of the view. RecyclerViews offer more flexibility and are more functional than ListViews.
The RecyclerView does, by itself, optimizations that had to be done manually before;
The view automatically creates the items surrounding the visible list so that they are ready when the user browses the items in the view.
Not only does the view create additional items as the user browses the list, but it also saves items already browsed, so that they are ready to be reused again if needed.
When the displayed elements change it is possible to automatically link the behaviors to the new elements.
A list using RecyclerView:
Other improvements have been made to Android libraries and the application architecture in general, as well as innovations in application lifecycle management. All these changes greatly simplify the creation of applications and make this development even more accessible to any interested developer.