Pedro G贸mez

Our Android 2020 development stack

One of the questions we face when talking with Android developers all around the world is related to the tools we use 馃 The selection of libraries and frameworks used by our Android team is one of the most interesting details in our development pipeline, so we will try to answer this question in this blog post 馃槂

When listing the libraries we use, we need to focus on various types of tools based on different topics: static analysis utilities, build tools, networking, persistence, permissions, user interface, core components, and testing. We have a bunch of tools we've used for years, and we will review them one by one.

Static analysis utilities & build tools:

These tools are really helpful for us. All they help us to go faster in our daily tasks by automating tasks or any other checks we want to do in our codebase 馃槏

  • Ktlint: Best Kotlin linter in town.
  • Android Lint: The best safeguard for your Android apps.
  • Lin: An awesome tool used to simplify the usage of the Android Linter created by @serchinastico. Really handy when we want to create custom rules!
  • Ribbonizer: Simple but powerful tool to add a ribbon to launcher icons.
  • Play publisher: Needed to automate our release process for internal and public releases.

Networking:

It's been a while since we started using tools to generate our networking layer based on a Swagger or OpenAPI yaml file, so the libraries we use under the hood are not so relevant. For our latest project, we've used this gradle plugin to generate our API client. However, when there is no chance to generate the API client, and there is no way we can create an OpenAPI file, we use these libraries:

  • Retrofit: If you don't know this library, you are going to love it! It generates a lot of code for you just from an interface 馃ぉ
  • OkHTTP: The best HTTP client you are going to find. Simple, but powerful :)
  • Gson: We've been using this library for years! There are other alternatives if you want, but we have to admit we always use this one when using automatically generated code 馃槂

As the code generated is completely coupled to the libraries used by the generator and the models created by this tool, we always wrap it with an adapter to avoid coupling issues.

Persistence:

We all know how handy our loved shared preferences can be... However, when we need a database, we have two choices:

  • Room: Officially maintained by Google, this is one of the best choices when you need a database.
  • SQLDelight: Generates typesafe Kotlin APIs from SQL queries.

For years we used Realm, but nowadays, the tooling for SQLite is excellent now, so we moved to one of the previous alternatives.

Permissions:

After years developing and maintaining a library to simplify the usage of permissions, we keep using Dexter! This library simplifies a lot the usage of the permissions API, letting you get the answer of a permission request in a callback instead of using the famous onActivityResult method.

User interface:

There is a bunch of libraries we use to build our applications user interface, so we are going to drop here just the most relevant ones:

  • Data Binding: The key to success when talking about the usage of MVVM four our presentation layer.
  • Lifecycle Observer: Handy when you want to listen for the events related to the component's lifecycle without coupling the implementation to any concrete component.
  • Appcompat: Useful when we need to use components in old Android APIs.
  • ConstraintLayout: The best way to create a responsive layout.
  • Glide: Useful when you need to download and show images asynchronously.
  • Renderers: We've been using this library for years and is one of the best libraries to work with recycler view.
  • Calligraphy: Nice library if you want to use custom fonts and for some reason you had no idea this was supported since 2017 :) (Thanks random reddit user for pointing me this detail out)
  • Material Components: We try to use standard material components when possible, so this library is really helpful because there is a bunch of them already implemented.
  • Snacky: World-class library if you want to show a snackbar.
  • Lottie: Render After Effects animations natively on Android.

Core components and other useful libs:

There are always a bunch of libraries we need deep down in our architecture, and we them use in every project. Let's talk about these:

  • Kotlin: Of course!!
  • Coroutines: Asynchronous programming with the best syntax in town.
  • Timber: A small and extensible logger.
  • Libphonenumber: When working with phone numbers in international formats, this library is the best option.
  • OneSignal: One of the best push notifications provider. Depending on the projects, we use the native support, but when possible we use OneSignal.
  • Kodein: For the last projects, we've used this dependency injector. However, we recommend you to choose your dependency injector based on your needs!
  • ThreeTenABP: Do you have to work with different regions for your dates? Take a look at this JSR-310 backport for Android.
  • Crashlytics: We've used this crash reporter for years, and we never regret.
  • Arrow: We tend to use more and more functional programming concepts in our software design, and we have to admit lenses, the core component, and the effects API are in all our Android projects.
  • Leakcanary: The best memory leak detection library.

Testing:

Prepare your speed face! This is going to be intense:

  • JUnit: Classic test runner.
  • Shot: Handy screenshot testing library.
  • Kotlin Snapshot: If you are looking for snapshot testing, this is your kotlin lib!
  • Kotlin Test: Because sometimes we need to use property based testing and this framework provides an awesome support.
  • Mockito: If you write unit tests, you'll need a mocking library.
  • MockWebServer: Really handy when we want to write tests to ensure our API client is implemented properly.
  • Robolectric: Needed to run our instrumentation tests as fast as possible.
  • Espresso: Needed to be able to interact with the user interface in our UI tests!
  • Barista: Espresso's best friend.
  • Jacoco: Needed to get a unified code coverage report.
  • Bitrise: The best CI & CD platform we've tested for mobile for now. Even when we prefer any platform we can configure using a yaml file like Travis CI. Bitrise's emulator performance is way better in this platform than any other competitors.

For us, the key to success in our testing strategy is simple. We need to be able to replace any dependency using test doubles when required. To do this, we use the dependency injector from our UI tests, or we do it manually in our unit and integration tests 馃槂 If you'd like to know more about it, take a look at these blog posts and also remember to take a look at our testing training.

This is it! 馃憦 Nevertheless, I'm sure you are missing some libraries while ready this post 馃 and we miss a bunch too! What about all these jetpack libraries we didn't mention, and Google released months ago? We use them depending on the projects and the people involved in the project:

  • LiveData: When we use room, and we want to connect our UI with the database using an observable implementation, we use this library.
  • Navigation: It all depends on the developer responsible for the project. I don't personally use it but, I'll give it a go on my next project!
  • ViewModel: I use a custom implementation linked with the dependency injector and the lifecycle observer library. However, some of use this library.
  • WorkManager: We don't always have to schedule tasks, but when we need to do something like this, this is the library we use.
  • CameraX: Used only when needed 馃摳

If you'd like to know more about these Jetpack Libraries remember we have some training about the most relevant components you can request us when needed.

Now we are over Android friends! I hope you enjoyed this 2020 libraries, frameworks, and tools review 馃槂 If you use a similar stack or you think there is any other library we should use, 聽please, let us know in the comments section! See you soon 馃

Photos by the Google Andorid Team, the Arrow Team, the Open API Generator organization and Mindorks.

Pedro G贸mez

I'm a software engineer focused on new technologies, open source, clean code, and testing. Right now I'm working as a Senior Software Engineer at Karumi, a little software development studio.