Since Google I/O kicked off last week our Android team have been busy playing with all the new features and releases. One of which is improved functionality for Android Jetpack. So we asked our Android developer Martha to explain what using Android Jetpack for app development means for us and our clients.
What is Android Jetpack?
Essentially, Android Jetpack is a set of “unbundled” libraries, tools and guidance which improves the quality of Android apps, reducing crashes and memory leaks with backwards compatibility. It combines the existing Support Library as well as the Architecture Components which were introduced at Google I/O 2017. The best part of Android Jetpack for app development is that the libraries (Architecture, UI, Foundation and Behaviour) are individually adaptable but are built to work together as well, so you can run the apps on different versions and you can adapt each library separately. Therefore, you can add the components you need in your existing code. As a result, the testability is improved and you can create high-quality apps. Moreover, Android Jetpack supports Kotlin integration, which helps us create apps with less code.
At Google I/O 2018 5 new components have been announced: WorkManager alpha release, Navigation alpha release, Paging stable release, Slices alpha release and Android KTX (Kotlin extensions) alpha release.
This is a powerful new library that provides the ability to specify deferrable, asynchronous tasks and when they should run. You can create a task, choose appropriate circumstances for it and hand it off to WorkManager to run at an appropriate time. Further, the task is still guaranteed to run, even if your app is force-quit or the device is rebooted. We don’t need to figure out the device’s capabilities or check its API; the WorkManager will choose the best option. Moreover, you can show UI (User Interface) for the task’s status with the use of LiveData. One of the advanced features is that you can also set up a chain of tasks; tasks are queued up one after the other and are implemented one at a time.
This is a framework for structuring the UI for your app while using the most fitting architecture. In addition, you have access to the Architecture Components such as Lifecycle and ViewModel. Furthermore, Navigation handles the FragmentTransactions. While it allows you to declare the transitions, it builds the correct behaviour (moving back and forth), supports deep links and creates the best connection between Navigation and the UI widgets.
This simplifies the process of loading and presenting large data sets in a fast speed in the app’s RecycleView. It can load data either from the local database or from the network, or even both, and you can define how the data gets loaded. It is also compatible with Room, LiveData and RxJava. The biggest perk of the Paging component is that it doesn’t consume as much network bandwidth as it used to, uses fewer system resources, and the response is quick even when the data is being updated or refreshed.
This consists of UI templates that can display content from your app from within the Google Search app and now in the Google Assistant as a result of the search. Slices support live data, scrolling content, inline actions, and deep linking into your app. Slices can also contain interactive controls like toggles, and sliders. With Slices, you can include text, images, videos and/or interactive controls that allow users to see your app as a recommendation to their needs. For the last part, we will also need to use App Actions. It is a new way to make your app’s capabilities and content more accessible, so that people can easily get to it at the right moment. App Actions will appear to users based on usage and relevance, across multiple Google and Android surfaces. Such as; the Google Search App, the Play Store, the Google Assistant, and the Launcher. Moreover. We’re now able to build a Conversational Action by using a variety of Assistant-enabled devices, e.g. speakers and smart displays.
This is a set of Kotlin extensions that improves the efficiency of Jetpack and the Android platform APIs. Its purpose is to make Android development easier and more concise by taking advantage of Kotlin’s existing features. The Android Runtime (ART) in Android P has been upgraded, so that apps built in Kotlin will run faster. It is also worth mentioning that the number of developers using Kotlin is growing each month; currently, it is 35 per cent. We’ve been building apps in Kotlin for a while now and have already seen the huge difference it makes to app development.
What’s new in Android Studio 3.2?
Android Studio 3.2 includes new tools for Android Jetpack such as the Navigation Editor and new tools for code refactoring. In addition, this release includes;
- Build tools to create the new Android App Bundle format.
- Snapshots in the Android Emulator for fast start time.
- An R8 optimiser for smaller download and install app code size.
- An Energy Profiler to measure app impact on battery life.
Since the Android Support Libraries are now part of Jetpack, we need to refactor the old ones to a new Android extension library whose namespace is androidx. This Canary version provides help for migrating an existing project into the new Library, while the Android Studio will automatically convert the project’s dependencies.
So what does Android Jetpack mean for App Development?
In conclusion, the developer community has grown dramatically in the last couple of years. All of the new releases and libraries for Android are aimed at improving both the developer experience and user interactions. It is a very important investment which will increase developer productivity as well as all the other benefits listed above. Android Jetpack for app development ultimately leads to smarter, user-friendly apps. Apps will now also be able to expand their usability into other devices besides smartphones and tablets. This creates new opportunities to introduce a whole new area of development just waiting to be explored!