Starting with Jetpack Compose
I got very excited when I saw the announcement of Jetpack Compose at Google I/O 2019. It felt like Google was announcing the next big step to ease Android development. However, trying out the developer preview required some effort, and I never got around to it (other developers did). This October, at the Android Dev Summit, Google released Android Studio 4.0 Canary, which makes trying Compose a lot easier. Now I could finally dig in!
In this blog post I take you along on my journey to understanding and trying out Jetpack Compose. This can help you find the right resources and have a head start the moment Jetpack Compose is ready for production.
Watching & Reading
I firmly believe that before experimenting too much with a new framework, you should at least know a little bit what problems it tries to solve. There are some great talks on Jetpack Compose, why it was built and what problems it tries to solve. Here’s a list of resources that I watched before starting any development myself:
- Understanding Compose: A deep dive that you should definitely watch. Leland Richardson explains what problems Jetpack Compose aims to solve, and how it’s currently implemented. The contents of this talk are not available in any documentation or blog or written form yet, so even if you don’t like watching YouTube videos, try to watch it!
- What’s new in Jetpack Compose: Not really a what’s new talk, but an explanation of the high level concepts of the toolkit, and more information about its workings. More practical and definitely worth a watch.
Next to these videos, there are some blogs that already explain some of the concepts and implement some basic screens with the toolkit. Most aren’t that useful compared to Google’s own resources, however I thought this review by Pedro Gómez was worth the read, especially since it contains some possible issues and Google’s response to them.
Following along
Since the toolkit is still very new, there aren’t many tutorials yet. Google provides one tutorial, and one code lab. These mostly touch on the same basic concepts and are quite interchangeable. I didn’t really learn more from these than I did from the videos, but on the positive side they help you set up your machine to start developing. I personally use the Jetbrains Toolbox so it’s easy to download and update the Canary version next to the stable version of Android Studio. Of course you can also download the Canary version directly.
Source Code
It’s clear that Google has some great technical writers working on Compose. The generated documentation coming from the source code introduces many concepts that aren’t touched upon in the tutorial. The documentation also mentions current deliberations and possible future changes. When I’m bored, I regularly just start opening random classes from the androidx.compose package, read the docs and see if I understand what’s going on. (Spoiler: I mostly do not 😬).
Next Steps
My next step in the journey to learn Compose is to really start playing with it. There is a sample app available on Github with some nice features and I can’t wait to make something similar myself! Next to that, I want to try to implement some complex UIs using Compose. And I’d like to try to create a Compose UI for a large scale app, to see how hard it would be to migrate when version 1.0 is released.
How are you getting yourself familiar with Compose? Do you agree that it’s promising? What don’t you like about it? Tell us in the comments! Liked to read this article? Let me know by 👏!