explaingit

didi/virtualapk

9,057JavaAudience · developerComplexity · 4/5LicenseSetup · hard

TLDR

VirtualAPK is an Android framework from Didi that lets a main app dynamically load and run additional APK files as plugins at runtime, without those plugins needing to be installed on the device.

Mindmap

mindmap
  root((VirtualAPK))
    What it does
      Plugin APK loading
      Dynamic execution
      Runtime extensions
    Supported components
      Activities
      Services
      Broadcast Receivers
      Content Providers
    Setup
      Host app config
      Plugin app config
      Gradle plugin
    Compatibility
      Android API 15+
      Most devices
    Origin
      Created by Didi
      Used by Uber China
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Split a large Android app into a core host app and plugin APKs so users download only the features they need.

USE CASE 2

Update specific app features by pushing a new plugin APK without requiring a full update from the Play Store.

USE CASE 3

Load a partner's plugin APK inside your host Android app to extend functionality without merging their code at build time.

Tech stack

JavaAndroidGradle

Getting it running

Difficulty · hard Time to first run · 1h+

Both host and plugin projects need specific Gradle configuration, and the plugin build must point at the host project's source to wire components correctly.

Use, modify, and distribute freely for any purpose including commercial, as long as you keep the copyright notice.

In plain English

VirtualAPK is a framework for Android apps that lets a main app load and run additional APK files without those extra apps being formally installed on the device. An APK file is the standard package format for Android apps, and normally an app can only use code and resources that were baked into it at build time. VirtualAPK changes that by treating external APK files as plugins that the host app can pull in and execute on the fly. For developers, this means you can split a large Android application into a core app and several plugin APKs. The plugin APKs do not need to be listed in the host app's manifest file, which is normally required for Android components like activities, services, and content providers. VirtualAPK handles that registration step automatically at runtime. Plugin code can also access classes and resources from the host app, and the host app can launch screens from a plugin just as if they were part of the original build. The setup involves two sides: the host project (the main app) and the plugin project (the add-on APK). Both require adding VirtualAPK's Gradle build plugin to their configuration files. On the host side, you initialize a PluginManager when the app starts, then call a load method to bring in an APK file from storage. On the plugin side, you configure a package ID and point it at the host project's source so the build system can wire them together correctly. The framework supports Activities, Services, Broadcast Receivers, and Content Providers inside plugins. It works on Android API level 15 and above, covering nearly all devices. Known limitations include no support for notifications with custom layouts in plugins and no support for certain transition animations. VirtualAPK was created by Didi, the ride-hailing company behind the Didi Chuxing app, and was also used by Uber China. It is released under the Apache License 2.0.

Copy-paste prompts

Prompt 1
I want to split my Android app into a host and plugin APKs using VirtualAPK. Walk me through the Gradle configuration for both projects.
Prompt 2
How does VirtualAPK handle Android Activities and Services inside a plugin APK at runtime without listing them in the host manifest?
Prompt 3
I've built a plugin APK with VirtualAPK. What is the minimal code to initialize PluginManager and load the APK from storage in the host app?
Prompt 4
What are the known limitations of VirtualAPK, specifically around notifications and transition animations inside plugin APKs?
Open on GitHub → Explain another repo

← didi on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.