Android Makers Paris 2022

Illustration from frog.co

The Android Makers conference kicked off in Paris on April 25th for 2 days of sessions, workshops and showcases. It brought together more than 600 attendees for over 60 sessions.

Thanks to frog, I had the opportunity to attend the conference and I am happy to share my notes on some of the sessions with you. If you want to go further, have a look at the replays available on YouTube.

Did you know that Android started in 2003 as a digital camera platform called FotoFarm? Now you know! Due to the lack of interest, the project expanded to phones and was acquired by Google in 2005. In 2007, the first iPhone launched and revamped the phone industry, boosting competition. In the same year, the first Android SDK was released and one year later, Android 1.0 was released on the T-Mobile G1 phone.

What can we learn from Android is that having the right team, working hard, shipping something and making good decisions are the keys to success. The timing is also very important, as well as a little bit of luck.

If you want to know more about the history of Android, I would recommend to read the book Androids: The Team That Built The Android Operating System.

Photo by Soriya

An app can either be an APK or an Android App Bundle while a library can either be a JAR or an AAR.

Libraries require additional development considerations compared to apps and even more requirements when publishing to Maven Central:

  • Minimize transitive dependencies and prefer stable versions
  • Minimize public APIs and avoid breaking changes
  • Declare public resources and avoid conflicts
  • Ship consumer ProGuard rules
  • Sign files with GPG/PGP
  • Submit a POM file

UI tests ensure a good integration of other, smaller, units already covered with unit tests. Discovering issues before shipping to production is more efficient because deploying hotfix releases takes a long time.

However, UI testing is painful and contains a lot of tasks like writing, running and collecting instrumented test results.

The AndroidJUnitRunner and the Android Test Orchestrator allow to build, install and run tests on devices. Each test is run is its own Instrumentation but it might not be fully isolated since cached data can persist and should be cleared between tests. To solve the problems of flakiness, speed and tooling, you can use test runners like Marathon.

Also, testing on a real device offers higher fidelity while testing on an emulator offers more control. Since emulator is fast to run and highly configurable, it is a good practice to use it with Docker images.

At Deezer, developers share common code between different apps and form factors like Android TV or Wear OS, using internal libraries published on a Maven repository.

They decided to only share code that is reused multiple times while keeping specific behaviors in consumers. The libraries are split into smaller ones to include only what is needed by each consumer.

Each library can contain multiple modules and has a sample app to quickly test and iterate. For the sake of simplicity, they use a unique Git repository containing multiple Gradle projects with the same version for all libraries. In more complex projects, a Bill of Materials could be used.

Stable versions are released with the same rhythm as the apps while snapshot versions are released nightly.

As a best practice, even for private libraries, don’t forget the documentation and the release notes.

Historically, Android devices were only phones or tablets. Now, foldable devices make this distinction totally obsolete with size changing dynamically.

Screen size is not the only aspect to consider, the ratio can also significantly change from one device configuration to another so it is important to always try apps on multiple devices, navigate with different inputs and think about accessibility.

To deal with many partners and devices, Disney Streaming invested in R2D2 Framework, an internal framework to simplify tests with all these complex form factors and partners.

The kotlinx-coroutines-test library has significantly changed since version 1.6.0 and is designed to easily test coroutines.

The first thing to use is the runTest coroutine builder to test code that needs to run in a coroutine. It will create a TestScope that will always use a TestDispatcher, which will be either a StandardTestDispatcher by default or an UnconfinedTestDispatcher.

Always inject dispatchers, so that if the code under test moves execution to a different dispatcher, it can be replaced with a TestDispatcher. For cases where it is not possible to inject a dispatcher, e.g. using a viewModelScope, use Dispatchers.setMain before test and Dispatchers.resetMain after test. Finally, keep in mind that unlike cold flows, hot flows never complete normally.

For more information, check out the revamped guide on Testing Kotlin coroutines on Android.

When talking about design, it is important to distinct UI and UX. UI stands for user interface while UX stands for user experience. Considering a button for example, the UI determines the appearance of the button while the UX determines its usage.

Material You is the new Design System available with Android 12, it goes further Material Design and makes user experience even more personal. But don’t forget that they are as many different user experiences as users.

Photo by Soriya

The responsibilities of a UI Toolkit are to define how a component is laid out, how it is drawn and how it interacts with inputs.

The Views UI Toolkit relies on inheritance, which is harder to maintain, while the Compose UI Toolkit relies on composition, which favors reusability. For this reason, Views moved to Compose to simplify declaration.

If you want to see how to build a UI Toolkit from scratch, Apex is a sample UI Toolkit developed by Romain Guy and Chet Haase based on the Entity-Component-System.

Jetpack Datastore is a replacement for the platform SharedPreferences.

It allows to save key-value pairs with Preferences DataStore but also typed objects with Proto DataStore and protocol buffers.

Most importantly, it provides built-in support for coroutines which make it the storage solution for Modern Android Development.

Build time has a big impact on productivity and has always been challenging to improve. Analyzing the build scan can help you identifying what takes a long time but here are some tips.

Using annotation processors, buildSrc directory or the JaCoCo plugin can negatively impact build time, just as mixing IDE and command line because it loses performance optimizations.

On the other hand, using build cache, incremental compilation, daemons and configuration avoidance can positively impact build time, as well as buying an Apple Silicon.

Mentoring is about making people grow, giving back to the community and building a network on the long term. Most of the time, the mentor is a senior engineer, and in all cases, the mentee is a less experienced engineer.

It is important to build a safe environment for the mentee where he can make mistakes, ask questions and learn. In the beginning, a mentor can onboard a mentee on a company, a project or a codebase. Then, keep it going with pairing and reviews, be patient, be humble and remind the mentee that the mentor also makes mistakes. Finally, constantly deliver feedback but also celebrate successes.

Compose is the future of Android UI development and it can be progressively integrated in an existing app, with a Design System.

A Design System can be built on top of Material Design which is highly configurable, or from scratch to better suit your needs. Doing so requires to develop atoms like colors and icons, then molecules based on these atoms, and so on. Having a sample app on a Design System makes it easier to test and maintain.

Kotlin Multiplatform is not a framework, it is an SDK built to share code with different platforms in a single codebase.

It best suits the business logic which is platform independent while the UI can still be developed natively or with a framework. When needed, use the expect keyword for common code and the actual keyword for platform specific implementation such as Android, iOS or Desktop. Compose is the right choice for the UI because Compose Compiler and Compose Runtime are platform agnostic while Compose UI Toolkit are available for each platform.

Multiple libraries support Kotlin Multiplatform and apps like Netflix already use it.

Last but not least, this edition of Android Makers, or rather Android Wakers, ended with the traditional comedy talk by Chet Haase and Romain Guy debating about architecture with a lot of fun!

Photo by Soriya

Thanks to the staff, to the speakers and to everyone for this amazing time, see you next year!

--

--

Software Engineering Manager at frog

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store