Mobile Development 19 min read

How Alipay Scaled AndroidX Migration Across Its Massive App Ecosystem

This article details Alipay's comprehensive AndroidX migration for its Android app, covering the deprecation of Android Support, industry adoption statistics, technical challenges, a modular adaptation strategy, tooling such as Jetifier and a custom bx command‑line utility, and the resulting impact on build time and product output.

Alibaba Terminal Technology
Alibaba Terminal Technology
Alibaba Terminal Technology
How Alipay Scaled AndroidX Migration Across Its Massive App Ecosystem

Background

Since Android Support was discontinued in 2018, AndroidX has become the community‑backed successor, with many frameworks and apps adopting it. Continuing to rely on Support would isolate a project from new components such as Paging 3.0, CameraX 1.0.0, Hilt 1.0.0, AppSearch 1.0.0, and Jetpack Compose.

AndroidX Industry Situation

Analysis of the top 50 apps in a major app store shows that about 70% have already migrated to AndroidX, indicating a strong industry trend despite the remaining 30% of high‑traffic apps still using the old libraries.

Why Some Apps Still Haven’t Migrated

Technical debt, diverse architectures, varying business needs, and limited development capacity create resistance to a full migration.

Wallet (Alipay) AndroidX Adaptation

Alipay designed a flexible technical solution that allows each business module to adopt AndroidX either through deep source code changes or via a fallback mechanism when full adaptation is not feasible.

AndroidX Adaptation Points

Java/Class source – replace Support classes and packages.

XML layouts – replace Support component names.

build.gradle – update dependency coordinates.

ProGuard – replace obfuscation rules.

POM dependencies – adjust dependency declarations.

Wallet Architecture Overview

Alipay’s Android development differs from vanilla Android. Two diagrams illustrate the contrast between traditional Android development and Alipay’s modular, bundle‑based approach.

The key benefits are business isolation (Bundle), build separation (mPaas + Bundle), and product aggregation with dynamic delivery (mPaas + Portal + Bundle).

Resistance and Motivation

Widespread use of Support libraries creates API compatibility challenges.

Cross‑team modules lead to coordination overhead.

Official upgrade mechanisms do not fit Alipay’s build system.

Dynamic layout containers cause conflicts.

Motivations include the end‑of‑life of Support, growing community adoption of AndroidX, modern Android development standards, and concrete business demands.

Solution Requirements

Minimize external dependencies.

Maintain compatibility.

Low intrusiveness.

Pluggable adaptation.

Implementation Details

Class Replacement – Dex files are parsed and Support‑to‑AndroidX class mappings are applied directly to the compiled bytecode.

XML Replacement – Binary XML resources are decoded, Support component references are swapped for AndroidX equivalents, and the files are re‑encoded.

Bundle Replacement – After class and XML updates, a new APK is generated and bundle dependencies are updated accordingly.

Resulting product changes are illustrated below:

Report Generation

OLD: /Users/█████/work/android-phone-█████-git/build/build/outputs/apk/debug/█████-build-debug.apk
NEW: /Users/█████/work/android-phone-█████-git/build/build/bundle-cache/█████-build-debug.apk

class count: 53
xml count: 1

=================
====   DEX   ====
=================
* com/alipay/android/█████/… (3)
* com/alipay/mobile/█████/… (45)
… (additional mappings)

=================
====   XML   ====
=================
* res/layout/███████████████.xml (1)
  | android.support.v4.view.ViewPager -> androidx.viewpager.widget.ViewPager

Command‑Line Tool (bx)

Alipay packaged the adaptation logic into a standalone JAR that can be used as a Gradle plugin or a CLI tool.

bx --input=src/test/resources/█████.apk --output=build/intermediate
user % bx --help
    ___              __           _     ___  __
   /   |  ____  ____/ /________  (_)___/ / |/ /
  / /| | / __ \/ __  / ___/ __ \/ / __  /|   / 
 / ___ |/ / / / /_/ / /  / /_/ / / /_/ //   |  
/_/  |_/_/ /_/\__,_/_/   \____/_/\__,_//_/|_|

Translate apk to compat with AndroidX dependency.
Usage: bx [OPTIONS] [ARGS]...

Options:
 --help         Show help information
 --input        Path to the APK to process, e.g. --input=input.apk
 --output       Output directory for processed artifacts, e.g. --output=output-dir
 --clean        Clean intermediate files, e.g. --clean=true
 --verbose      Enable debug logging, e.g. --verbose=true
 --jetify       Use Jetify during processing, e.g. --jetify=true

Jetifier Integration

Android Studio’s “Migrate AndroidX” and the Jetifier tool can automatically rewrite Java, XML, POM, and ProGuard references from android.support.* to androidx.*. The Jetifier core library (androidx.jetifier:jetifier-core:1.0.0‑beta10) is used by Gradle’s Artifact Transform mechanism.

android.useAndroidX=true
android.enableJetifier=true

Jetifier can also reverse the process with the -r flag.

Future Work

Most Alipay business modules have completed AndroidX migration; remaining modules with deep Support usage are being migrated gradually. The team is also advancing Kotlin and Java 8 adoption to further modernize the codebase.

Conclusion

Alipay’s systematic AndroidX migration demonstrates a scalable approach for large‑scale Android applications, combining automated tooling, modular architecture, and careful handling of legacy code to achieve a smooth transition to modern Android development practices.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

APKGradleAndroidXJetifierAlipayAndroid Migration
Alibaba Terminal Technology
Written by

Alibaba Terminal Technology

Official public account of Alibaba Terminal

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.