Top 5 Android development technologies to watch in 2020

Although the programming environment changes every day, Android is undoubtedly the most frequent update iteration, with new things every year or even every month. This article introduces the top 5 Android development technologies that developers need to focus on in 2020.

At the Droidcon London 2019 conference where many Android development teams participated, a series of new technologies were dazzling. From the accessible smart guitar [1] introduced by Joe Birch to the upcoming Jetpack Compose library [2], there are too many innovations, and the mainstream community needs to find several core technologies in order not to get lost.

This article will take you through some core technologies that need to be focused on. At the same time, this article will explain why these technologies should be implemented first, and some initial ways to achieve them. It is important to emphasize that although implementing these technologies will not amaze your end users, they can help developers create shocking features and bring developers a more pleasing code base!

1. Kotlin

Kotlin is usually regarded as the next Java, which is sponsored by Google and JetBrains (Android Studio developer). Java has been the development language of choice for Android applications from the beginning, but Kotlin has rapidly gained popularity in recent years. Today, nearly 60% of 10,000 Google Play applications use Kotlin [3]. Although a few cases require access to the underlying native code, C ++ will continue to be used; in other cases, Kotlin can replace Java.

The main advantage of Kotlin is full interoperability with Java, which means that developers can migrate old code as much as possible without completely rewriting the entire application. The two languages ​​are very compatible, and Android Studio can even automatically convert from Java to Kotlin.

This compatibility, combined with a more concise syntax and hundreds of small improvements, makes Kotlin the fourth largest "most popular" and fifth largest "want" in StackOverflow's 2019 developer survey [4] The programming language ranks highest among all mobile programming languages.

A good way to migrate existing applications is to convert them to Kotlin when modifying existing Java files. Although this means that you need to convert frequently edited files in the past, it will increase the complexity of code review (such as potential conflicts), but because the converted area can be reviewed, it can ensure that any problems can be found.

The Kotlin code currently used in Candyspace accounts for 86% (and has been growing), and the remaining 14% is utility / transformation code, which has not been changed in some years.

2. Jetpack

Google's AndroidX / Jetpack library is a set of practical tools designed to simplify common application requirements. For example, Room [5] for the database on the device, or LiveData [6] for updating the display content when the underlying data changes.

With the Jetpack library, the new project saves the hassle of reinventing the wheel, and does not have to wait for other developers to open source their implementation. Now every developer can get those basic elements. These libraries are updated frequently, new features are constantly being introduced, and bug fixes will be released in time. Because these libraries are built to work together, using more AndroidX libraries can help minimize accidents in the application.

Using the Jetpack library from the beginning of the development work can save hundreds of hours, but we can also migrate existing applications to the Jetpack library. Although it may seem cumbersome, because these libraries are so popular, it is easy to find guidelines for migration work. At least, the underlying Android elements (views, fragments, etc.) can be automatically converted [7].

In Candyspace, we used Data Binding and ViewModel, and may soon join Room and Navigation.

3. Modular design

All along, the application has been built as a huge "application" module, which contains everything needed for the entire application. Although this does make it easier to share resources, it also means that some parts of this application cannot be reused by other applications / open source projects; more importantly, the entire code base must be recompiled when making changes to the application.

Conversely, if the application consists of many smaller modules, you only need to recompile the code that made the changes, which greatly reduces the build time. In addition, the modular design opens the door to applications with advanced Android features (such as instant apps—users can use some of your app ’s features without installing anything, and dynamic features—installing parts of the app on demand).

Splitting an existing application into multiple modules may be a very complicated task, because it will find the previously hidden problem ("What is DateUtility? Why do you need it in every class !?"); but Once the transformation is complete, the code base will enter a healthier state. In addition, if a new application requires similar functionality, you can quickly reuse existing modules, saving you time!

An example of a modular application architecture (source: created by the author of this article)

Although designing a modular architecture can be a complex task, I have written some guiding principles before [8], which were inspired by Nikits Kozlov ’s article on modularity and build time [9]. Plaid also wrote an article describing their migration experience to modular design [10].

At Candyspace, our application designs are completely modular to minimize the disruption of development time due to build time.

4. App Bundle

When using traditional APKs to distribute apps to users ’devices, all resources prepared for all devices must be installed. This means that there may be 5 copies of each bitmap image (for different screen accuracy), multiple library versions for different device architectures, and even multiple sets of margins and padding values.

When using App Bundle to distribute an application, the APK that the user downloads contains only the resources they actually need. In this way, the average application size will be reduced by 20%, and the application size will be more significantly reduced after the unoptimized application changes the format.

Example of reducing the size of the application (data from Google I / O 2018)

App Bundles were born just 18 months ago, but more than 25% of apps are already installed in this format! This is the format recommended by Google [11], and most applications can use this format with almost no changes, just process the App Bundle signature on the Play Store.

At Candyspace, we are migrating to App Bundles while trying to avoid disrupting our existing workflow (Slack, QAing build, non-Google Play installation). Alistair Sykes' article is a great migration reference [12], which takes into account CI server, Slack, and Google Play internal application sharing.

5. Test

Yes, test. Of course, testing is not a shiny new feature, nor is it what users can see, but to ensure the reliability of an application that already has a certain user base, you must thoroughly test your application. Since the crash rate will directly affect your Play Store rating (and will definitely drag down the rating!), You should try to keep it at a low level.

image

Test pyramid (source: developer.android.com)

The three most common test types for Android are (in descending order):

  • Unit tests, for example: Will my square root function return square root?

These tests will constitute most of your testing process, they are used to ensure that a specific code segment (such as a function) can function as expected. When you have confidence in a part, you can use it for ...

  • Integration Testing. For example: Can my math module work with the position module?

These tests ensure that your various code areas (modules or layers) can work together properly. Once you know that the components of the application can communicate with each other correctly, you can add ...

  • Automated UI testing, for example: Can users mark a location on the app?

Only these tests are run on the device or emulator, and they ensure that the application provides the complete user experience as expected. These tests are usually much slower (and more inconvenient to run) than other types of tests.

Google recommends that the distribution of tests be set to 70% of unit tests, 20% of integration tests, and 10% of large-scale tests. The smaller part requires longer execution time, maintenance time, and implementation time.

The best test resource is the official document [13], because it provides an introduction to all test types and tutorials on how to implement it into the project.

At Candyspace, we focus on unit testing, which accounts for a larger proportion than Google suggests to ensure that the behavior of all new classes is predictable. We are currently improving automated UI testing to reduce the reliance on manual testing.

In any field of programming, there are a hundred different opinions about the best way to solve problems; but Android has an absolute advantage: Android has a large developer community, which means that a very good new technology will be developed quickly Popular among those. When you ask a stranger for help on the Internet, if you are looking for "Jetpack LiveData" instead of "the library that the previous developer copied and converted from a web developer friend", the chances of successfully getting an answer are high Much more!

The key to maintaining a healthy code base is to be able to adapt to these changing standards and refactor existing projects. In order to understand the latest Android development practices and best practices, I recommend that you follow the Android Developer Blog [14], / r / AndroidDev subreddit [15], and Fragmented Podcast [16].

For the latest technology, I recommend to you the simplest and most effective way to improve: brain map + video + information

In this also own a share included finishing Ali P6P7 Andrews [+] Advanced information sharing raises questions quit the necessary surface , as well as advanced technical architecture Advanced Brain Mapping, Android interview with thematic development, advanced materials advanced architecture of these These are all fine materials that I will read repeatedly in my spare time. In the brain map, each topic of knowledge points is equipped with a corresponding actual combat project, which can effectively help you master the knowledge points.

In short, it is also here to help you learn and advance, and save everyone the time to search for information on the Internet to learn, and you can also share with your friends to learn together.

Published 488 original articles · praised 85 · 230,000 views +

Guess you like

Origin blog.csdn.net/Coo123_/article/details/104436968