logoDroidKaigi Ninjas
DroidKaigi 2021

DroidKaigi 2021

Android App Development by Rakuten Service Driving Japan’s EC Market

Rakuten Group, Inc.
Oct 15, 2021

This is an English translation of the original Japanese article.

Rakuten Group EC business has two core services: Rakuten Ichiba and Rakuma. Here is a look behind the scenes at Rakuten Group’s Android app development.

Rakuten

In our aim to continue as a Global Innovation Company grounded in our philosophy of contributing to society by creating value through innovation and entrepreneurship, Rakuten Group has launched a variety of businesses.

This article provides a behind-the-scenes look at Android app development for the EC business’s two core services Rakuten Ichiba and Rakuma.

Rakuten Ichiba development and Android apps

As a giant in e-commerce technologies and under the brand slogan “Shopping Is Entertainment!,” our goal is to offer a seamless experience to our users.

Since the first release in 2011, the Rakuten Ichiba Android app has been downloaded over 10 million times and rated highly by users (Google Play Store rating: 4.3). It is one of the most popular apps today.

The history of the Rakuten Ichiba Android apps can be expressed in the words “change and transformation.

Along with the Android OS and development environment, our own development environment has also changed.

  • From Eclipse to Android Studio
  • From Java to Kotlin + Jetpack

The architecture and framework used have also continued to change.

  • From MVC and MVP to MVVM
  • From ListView to RecyclerView
  • From findViewById to data-binding
  • From AsyncTask to Rx and then to Coroutines
  • From GoogleAutoFactory to Dagger

As Rakuten has transformed into a global company, the development team and team members have also changed over that long period of time so that, today, engineers hailing from regions around the world, including Africa, Europe, and Asia, are involved in development (This is a harmonious team whose members understand each other’s different background and treat each other with respect.).

Development issues & challenges

Rakuten Ichiba is Japan’s leading e-commerce service. To maintain growth, it is necessary to regularly release new features and continue to make the service more attractive to users. At the same time in conjunction with this, the utmost attention needs to be paid to quality and new technologies incorporated to invest in the future.

Yet, with services and projects of this scale, it is not easy to achieve multifaceted continuous development of features, quality, and technical updates as well as maintain balance. As may be said about a variety of services, even a bug where one line of code is changed has tremendous potential to create issues with monetization, legal issues, and other fatal problems, and changing one dependency may affect the entire project code and compilation errors.

In addition, there are many services that Rakuten Group offers. Rakuten Ichiba is a core service with a tremendous user base. It is also integrated with many other services. Even a small change within the Rakuten Ichiba can significantly affect other services, so detailed and accurate methods are required for solving business and technical issues.

The methodology for solving issues adopted by the engineering team is: refactoring

The following saying resonates deeply with us.

“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.” - Martin Fowler

In 2018, MVP was employed for some of the Rakuten Ichiba Android app architecture and the language used was Java. One would be hard-pressed to say that, with the continued development of features over many years, the code conformed to SOLID principles. This would have meant taking time to develop features and risks would always accompany code modifications, and there would even be cases where it would have been difficult to write unit tests to ensure quality. So, refactoring was attempted of source codes so that they would be in line with standards for Android development.

The first thing which we considered was adopting Kotlin as the development language (Frankly speaking, we engineers were attracted to Kotlin’s simpleness and power. Even today, we are excited to write code in Kotlin.). When it was adopted, guidelines were set, after which we began to use Kotlin to develop new features.

The second major improvement was to decide to change our main architecture. For the architecture, we chose to adopt MVVM, which was popular at the time. Despite being simple to write about here, the decision was not an easy one considering apps for a service as large and complex as Rakuten Ichiba.

The first thing that we had to contemplate when selecting the architecture was the environment in which we operated.

  • Development of new features had to proceed simultaneously.
  • Existing code that was too old could not be reused.
  • Domain characteristics would not allow one architecture to be adapted to all applications.
  • Network and cash implementations needed to be revamped.

The following points were taken into consideration in making the selection as those that we wanted to achieve with adoption of the new architecture.

  • SOLID principles
  • Verifiability of business logic
  • Maintainability
  • Learning efficiency for new entrants

In addition to MVVM, we also considered other well-known architecture patterns such as MVI and Redux as candidates. We implemented POC and SWOT analysis and ultimately adopted MVVM.

At the same time as the new architecture was adopted, we also replaced and introduced new technologies.

  • From Volley to Retrofit
  • From Volley to Glide
  • Logging with Timber
  • DataBinding

Users of Rakuten Ichiba Android apps might remember that an overhaul was undertaken of UI and UX using Bottom Navigation in 2020. That was unable to be realized without refactoring those elements. Even after that, we continued refactoring with the adoption of Redux for search screens and improved network layer using Kotlin DSL.

Looking back at past changes and transformations

Tracing back the long path we have taken, bold decisions were made and executed during these years. Many of the decisions produced real benefit, but even when they did not, the experience gained from those decisions turned out to be valuable.

What we learned

  • To pay careful attention when making decisions about architecture. Decisions about architecture have a significant impact for a long time after that
  • Not to blindly jump at new technologies, but make smart choices
  • Think of the decisions as a choice between two alternatives
  • Always refer to past experiences when considering the future

“What is done cannot be undone, but at least one can keep it from happening again.” - Anne Frank

Future outlook

We hope to continue what we have been doing and to always adapt to Modern Android Development (MAD).

As for the adoption of new Android technologies, we have also been testing out Jetpack Compose. Rakuten Ichiba Android apps call for the preparation and use of multiple custom views to support complex UI requirements. Using Jetpack Compose makes it possible to support a variety of UI requirements with small amounts of code and we believe that this improves not only quality, but development speed.

In addition, we are working to create more loosely-coupled modules. We believe that this will enable us to add and delete features in a more dynamic and quicker fashion. We also anticipate improvements in troubleshooting and maintenance as well as other aspects for our large apps.

As modularization evolves, we are reorganizing out of the teams that we have had formed separately for the Android and iOS platforms and into teams specific for each domain. As one team surmounting barriers between Android and iOS engineers, our aim is for our engineers to realize their potential as the Rakuten Ichiba grows and to desire to “change.”

About Rakuma

Rakuma was created in 2012 and was Japan’s first flea market app (then known as Fril). We have set as our mission “Re:Valuation (redefining the value of things)” in our aim to change consumption in Japan to make people’s lives even better.

Toward a new system out of the hardship of system integration

Rakuma

Rakuma today is the result of two flea market apps integrating in 2018: Fablic Inc.’s Fril and the former Rakuma. Fril served as the base for the system, so Android apps were based on Fril, and the systems integrated and features added for the Rakuten Service Group.

The integration of services offered by the two companies was determined to be necessary from a business standpoint and entailed quite significant damage to the development structure.

Team members left and it was necessary to cede development resources to system integration rather than the development of features for the flea market app. At the time services were integrated in 2018, despite a cumulative 15 million downloads and annual transactions of ¥140 billion, the system had one Android engineer.

So, we began with rebuilding the engineer organization once again. We also gradually added new engineers and it took about one year before we were able to stably release new features. Currently, the mobile engineer team, which includes iOS engineers, is comprised entirely of engineers who joined after services were integrated and the team has transformed into a new development organization while still carrying on the aspirations of the previous team members.

Development environment easily adaptable to changing conditions

Development environment

We selected a basic environment for the development of the Rakuma Android app. We use GitHub for Git repository management, Bitrise for our CI/CD environment, and Firebase App Distribution for internal app distribution.

Unit testing has been automated. Slack commands are used for building apps and deployment, and Play Console uploading. Other processes have been automated as well. In addition, as we make use of GitHub Actions and other resources, we are also working to reduce some of the burden of code reviews.

MVVM+Clean Architecture has been adopted as our architecture.

Even when there was a dramatic decrease in the number of Android engineers, we were somehow able to overcome that, we believe, thanks to the move toward a basic environment.

Implementation is done in Android native and no cross platforms or other such technologies are used. Also, we have been able to maintain a simple system on the Android side with WebView for some transactions and other features and a clear division of responsibilities between the app domain and web domain.

Valuing ownership

 Rakuma ownership mindset

Rakuma is committed to three core values: User First, Ownership, and Fail Smart. Android engineers in particular comprise a team where there are many opportunities to demonstrate ownership.

As we develop numerous features simultaneously and concurrently, we do this within a cross-functional team structure so that processes may be quickly sent around and the team determines how to implement solutions to issues. Engineers also voice their opinions about design and customer support.

We believe that a culture where people are able to express their opinion about things that extend beyond their job description leads to even better service.

Current and future issues to address

We also have more members and a system in place in which our team is committed to shaking off legacy codes. So that our team is refactoring efficiently and strategically, Android engineers get together for one hour once a week to share progress, direction and other information about refactoring.

Major topics are:

  • Conversion from Java to Kotlin
  • Consideration of Multi-Module policies
  • Replacing Rx with Coroutines
  • Adoption of new Jetpack libraries (Compose, Paging library, etc.)

and so on.

Although some legacy Java code still remains, our entire team is working together to make the conversion to Kotlin. In 2018, over 70% was Java. Now, in 2021, over 70% is Kotlin.

The current module configuration is cut out from the main module only in the network layer requesting WebAPI. We will be organizing dependencies and right now are at the stage where we are considering how to divide these.

In conclusion

Employment

At Rakuten, we eagerly grasp opportunities to try new technologies and have put together a diverse team that develops our Android apps. New information is made available as articles are updated, so we hope that you will be sure to check our blog and other websites.

About the authors

  • Yusuf Wagh (Rakuten Ichiba)
  • Darquro (Rakuma)
Rakuten Group, Inc.
Rakuten Group, Inc.
Rakuten Group’s mission is to contribute to society by creating value through innovation and entrepreneurship, and we have launched a variety of businesses in Japan and around the world based upon that philosophy.
Go to Corporate Site