I’ve been an Android developer for 5 years, give or take. I started in 2015, back at school. At the time, I already hated Java, so I did something really unatural with the Android platform: I developped my first application in Groovy. Not the smartest thing I did in my life. I had to use the groovy-android-gradle-plugin in a very early version, with all configuration and compilation problems it brings. But it was tons of fun and I learnt a lot from it about development, compilation, differences between static et dynamic languages and, of course, the Android platform. So, it is ultimately one of the smartest things I’ve ever done in my life.

The result was Phœbius, a very basic music player that I stopped developping short after that and I also stopped Android development for a while. Until last year, when a new need arose. But by that time, almost everything had changed. Google had adopted Kotlin as its default development language, the famous support libraries had begun to be rewritten and a new way of developing Android applications had appeared in the form of Android Jetpack. I had to learn everything all over again…

So, this is it. Everything I would have liked to know about Android before I started developing FreshRSS.

The environment

First things first, to develop an Android application, you will need an Android IDE. This one goes by the name of Android studio. The IDE now relies on the Jetbrains platform which brought up some of the best IDE in the history of development. Namely PyCharm for Python, RubyMine for Ruby, IntelliJ for Java, etc.

It is now almost full-featured, but there were times when setting up an environment was messy. A few years ago, Android Studio was based on Eclipse. And you still can find internet pages telling you to download it. The SDK also had to be downloaded separately. This is now managed by the IDE.

Next to Android Studio, you might also need to install the command-line tools if you want to use a physical device for your development. They are available here, but if you are on Linux, they mose likely are already packaged by your distribution under the name of android-tools.

A little historical note

Android dates back to 2005 and is now at version 10. It comes bundled with a standard API used to develop the Android applications. This API as several levels which is how Google calls its versions. Android 10 comes bundled with API level 25. Level 24 corresponds to Android 9. Version 27 and 26 to Android 8.1 and 8.0 and so on…

If I tell you this, it’s not for the aesthete’s pleasure. It has a huge impact on the development of Android applications. With each SDK new release, new some features were added, other disappeared. For instance, lock screen widgets have been removed with Android 5 (API level 21) in favor of notifications. And speaking of notifications, their managment has changed considerably with Android 8.0 and the addition of channels.

This is the first thing to know, when you want to develop an Android application: the minimum and maxiumum versions of Android you want your application to run on so you know which API features will be available, which won’t and how to gracefully degrade on older versions.

The support libraries

To mitigate these version inconsistancies, Google started releasing support libraries in 2011. These libraries offer classes to wrap the standard Android API and handle gracefull degradation on older API versions. Those are not included in Android, so you need to add them to your dependencies yourself.

Beware, though: Here, we still stumble over the development history of Android. With the adoption of Kotlin, Google decided to start the development of these libraries almost from scratch. The development of the previous support libraries stopped at version 28.0.0 and the new support libraries are included in the Jetpack project. So, when you face a problem and you are tempted to trust Stackoverflow with the given answer, always verify that the provided solution does not rely on old versions of the support libraries. You can differenciate old support libraries from new ones by their package name.

Old support libraries have package names starting with android.support.*. New support libraries have package names starting with androidx.*.

Android Jetpack

So, as I said, the support libraries have now been migrated to the Jetpack project. But the Jetpack project is not only about the rewrite of the old support libraries. This is much more. It provides a whole new and easier way to develop Android applications. It contains tools to automatically sync the UI and the data, to design and automatically handle navigation between screens, provide you a unified and improved access to different versions of Android APIs.

But Jetpack is a huge project. Probably the biggest move Android has known for years. so it is easy to get lost and overwhelmed. If you’re starting Android development for the first time, you’ll probably bump into answers providing deprecated solutions on Stackoverflow and wonder why they don’t work the way you expect or why this class or that class doesn’t seem to exist. If you do, always refer the Jetpack’s documentation.

If you’re an experienced Android developer — well, first I wonder how you came to read this page and second, — you will have to learn all over again because the way Android applications are developped has changed a lot.

This page provides you a list of every library available in the Jetpack project. Besides third-party libraries providing you custom behaviours and components — for instance, Retrofit — Jetpack is the only minimum set of third party libraries you need to build Android applications. (You don’t need to add every single library in Jetpack, though. Just take what you need. Again: refer to the Jetpack webpage to know what components you’ll need during your development.)

A few more hints and conclusion

If Jetpacks provides you a huge set of cool tools to considerably easier Android development, you may need some extra tools to cover a few more needs. Here is a short list of cool libraries I use or would like to use in the future, sorted by theme.

  • UI:
    • Picasso is the first of several Android tools developped by Square that I’ll mention in this list. It’s a library to fetch through network, manipulate and display images.
    • davideas’ FlexibleAdapter is a very complete library to display lists of items with lots of interaction nativaly supported. For instance: item swipe, grouping with sticky headers, fast scroller, etc.
  • Networking:
    • Fuel is the networking library I use on FreshRSS as of this date (15-02-2020). It’s a very easy to setup and is compatible with a lot of extensions among which Gson, Jackson, Kotlin coroutines, KotlinX serialization, etc.
    • OkHttp: though I don’t directly use it, this library to perform HTTP requests — also developped by Square — is embedded in some of their other libraries I use or may use such as Picasso and Retrofit.
    • Retrofit is a library that generates boilerplate for requesting your HTTP API from a simple Java interface. All you need to do is declare the method signatures and the endpoint of your HTTP API, and Retrofit creates the Java code handling the network request and data ser/deser.
  • DB:
    • Roomigrant: if Jetpack provides a nice DB manipulation library with ORM support called Room, there’s currently no native DB migration mechanism. That’s what Rommigrant brings. It’s easy to setup and very powerful.
  • Async:
    • Kovenant even though Kotlin’s coroutines are the native way to do async in Android, there were not very easy for me to understand at first. My main asynchronous experiences were using JS’ Promises. If you have the same background as me and you want to quickly setup and work with async on Android, Kovenant provides support JS’ Promise-like objects.
  • Crash report:
    • ACRA lets you catch every uncaught exception and report application crashes through mail, HTTP or custom means. I personnally use Acrarium as a backend for crash reporting. It helped me a few times during testing beta releases.

I hope this article will help you and you will master Android development very soon. Have fun!

Summary of resources

  • The Android Jetpack project page offers an entry point for using Jetpack in your project. This is always a good place to start when you get lost in Android development but it links to so many resources that you quickly get overwhelmed.
  • The AndroidX overview offers an entry point on how to setup or migrate your Android project to use the Jetpack libraries.
  • The Jetpack library release pages offers an overview of all the Java/Kotlin libraries composing Jetpack. This page will be able to help you to make the correspondence between the old support libraries and those of Jetpack as well as help you to find the right version of the libraries you want to use.