Multi-module Android project codebase Basic setup with Dagger 2, Unit tests, jacoco report and others

Breaking the monolith to microservices is a well-known concept to make backend solutions extendable and maintainable in a scale, by bigger teams. Since mobile apps have become more complex, very often developed by teams of tens of software engineers this concept also grows in mobile platforms. There are many benefits from having apps split into modules/features/libraries:

  • features can be developed independently
  • project structure is cleaner
  • building process can be way faster (e.g., running unit tests on a module can be a matter of seconds, instead of minutes for the entire project)
  • great starting point for instant apps

In case you are struggling with multi-module Android project, I have created example app showing how to deal with things like:

  • Dependency injection with Dagger 2
  • Unit test
  • Jacoco tests coverage report

Even if those are very basic things, it can take some time to make them working correctly in multi-module Android app. To have working solutions in one place, I have created example project on my Github account. There will be more over the time (proguard, instrumentation testing, instant apps). But even at this stage it is also worth sharing.

Just take a look: MultiModuleGithubClient. Your feedback is warmly welcomed!

 

Basic Android app analytics in <60min One step towards data-driven development

Every big tech company today is data-driven. Products are more often built based on collected data rather than internal opinions. It’s very likely that in this moment some of apps on your device are serving you A/B test variants, checking how: new layout, text or even functionality affect your activity and engagement.
The biggest companies have dedicated Business Intelligence teams, their own data warehouses, custom analytics tools and big flat screens in conference rooms showing realtime charts.
And the most important — endless audience waiting to be analysed by pie charts or bars 📊.

Continue readingBasic Android app analytics in <60min One step towards data-driven development

FrameMetrics — realtime app smoothness tracking

A couple months ago, when Android Nougat was announced, among new features like Multi-window, enhanced notifications, VR support, 72 new emojis đź‘Ť and others, there was a new addition to monitoring tools: Frame Metrics API. Continue reading “FrameMetrics — realtime app smoothness tracking”

Activities Subcomponents Multibinding in Dagger 2

A couple months ago, during MCE³ conference, Gregory Kick in his presentation showed a new concept of providing Subcomponents (e.g. to Activities). New approach should give us a way to create ActivitySubcomponent without having AppComponent object reference (which used to be a factory for Activities Subcomponents).
To make it real we had to wait for a new release of Dagger: version 2.7.

Continue reading “Activities Subcomponents Multibinding in Dagger 2”

Building UserScope with Dagger2

In Azimo Android app we use Dagger 2 as a framework for Dependency Injection to make our code architecture clean and easy to scale. Like in our previous post we would like to share our experience so today I’ll show how to avoid issues and build custom UserScope which can be used in production app.

TL;DR

Custom scopes in Dagger 2 can give better control on dependencies which should live unusual amount of time (different than application and screen lifetime). But to implement it properly in Android app we need to keep in mind things like: scope cannot live longer than application process, process can be killed by system and restored in the middle of user flow with new objects instances.

Example source code is available here: Dagger 2 recipes: UserScope.

Continue reading “Building UserScope with Dagger2”

Dagger 2 on production — reducing methods count

Dagger 2 — fully static, compile-time dependency injection framework is a backbone of code architecture in Azimo Android app. We already know that with growing dev team clean code structure is one of the most important things in every project. Initialisation/usage separation, easier testing (unit or functional), better scalability —those are just a few of the benefits that come from use of dependency injection framework like Dagger 2.

Continue reading “Dagger 2 on production — reducing methods count”

Inject everything — ViewHolder and Dagger 2 (with Multibinding and AutoFactory example)

This post is a part of series of posts showing Dependency Injection with Dagger 2 framework in Android. Today we’re going to take a look at Multibinding and Autofactory and we’ll try to implement ViewHolder pattern with Dagger 2. Continue reading “Inject everything — ViewHolder and Dagger 2 (with Multibinding and AutoFactory example)”

Async Injection in Dagger 2 with RxJava

This post is a part of series of posts showing Dependency Injection with Dagger 2 framework in Android. Today we’re going to take a look at Asynchronous injection 2 with RxJava — alternative for Dagger 2 Producers Continue reading “Async Injection in Dagger 2 with RxJava”

AndroidDevMetrics — Activity lifecycle methods tracing

AndroidDevMetrics is a performance metrics library which will help you find potential performance issues in your Android app. Thanks to it we are able to measure objects graph initialization in Dagger 2, Activities lifecycle methods timings and frame drops for each screen in app.

Continue reading “AndroidDevMetrics — Activity lifecycle methods tracing”

Dependency injection with Dagger 2 — Producers

This post is a part of series of posts showing Dependency Injection with Dagger 2 framework in Android. Today we’re going to take a look at Dagger Producers — an extension to Dagger 2 that implements asynchronous dependency injection in Java.

Continue reading “Dependency injection with Dagger 2 — Producers”