Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
V

VirtualAPK

> 编程语言
Open source

A powerful and lightweight plugin framework for Android

9.1K stars0 likes1 views
WebsiteGitHub

About

A powerful and lightweight plugin framework for Android

Android 9.0 supported! Please use the lastest release.

VirtualAPK is a powerful yet lightweight plugin framework for Android. It can dynamically load and run an APK file (we call it LoadedPlugin) seamlessly as an installed application. Developers can use any Class, Resources, Activity, Service, Receiver and Provider in LoadedPlugin as if they are registered in app's manifest file.

Supported Features

Feature Detail
Supported components Activity, Service, Receiver and Provider
Manually register components in AndroidManifest.xml No need
Access host app classes and resources Supported
PendingIntent Supported
Supported Android features Almost all features
Compatibility Almost all devices
Building system Gradle plugin
Supported Android versions API Level 15+

Getting started

Host Project

Add a dependency in build.gradle in root of host project as following.

java
dependencies {
    classpath 'com.didi.virtualapk:gradle:0.9.8.6'
}

Apply plugin in application module of build.gradle.

apply plugin: 'com.didi.virtualapk.host'

Compile VirtualAPK in application module of build.gradle.

java
compile 'com.didi.virtualapk:core:0.9.8'

Initialize PluginManager in YourApplication::attachBaseContext().

java
@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    PluginManager.getInstance(base).init();
}

Modify proguard rules to keep VirtualAPK related files.

-keep class com.didi.virtualapk.internal.VAInstrumentation { *; }
-keep class com.didi.virtualapk.internal.PluginContentResolver { *; }

-dontwarn com.didi.virtualapk.**
-dontwarn android.**
-keep class android.** { *; }

Finally, load an APK and have fun!

java
String pluginPath = Environment.getExternalStorageDirectory().getAbsolutePath().concat("/Test.apk");
File plugin = new File(pluginPath);
PluginManager.getInstance(base).loadPlugin(plugin);

// Given "com.didi.virtualapk.demo" is the package name of plugin APK, 
// and there is an activity called `MainActivity`.
Intent intent = new Intent();
intent.setClassName("com.didi.virtualapk.demo", "com.didi.virtualapk.demo.MainActivity");
startActivity(intent);

Plugin Project

Add a dependency in build.gradle in root of plugin project as following.

java
dependencies {
    classpath 'com.didi.virtualapk:gradle:0.9.8.6'
}

Apply plugin in application module of build.gradle.

apply plugin: 'com.didi.virtualapk.plugin'

Config VirtualAPK. Remember to put following lines at the end of build.gradle.

virtualApk {
    packageId = 0x6f             // The package id of Resources.
    targetHost='source/host/app' // The path of application module in host project.
    applyHostMapping = true      // [Optional] Default value is true. 
}

Developer guide

  • API document wiki
  • Sample project PluginDemo
  • Read core library source code
  • Read Release notes

Known issues

  • Notifications with custom layout are not supported in plugin.
  • Transition animations with animation resources are not supported in plugin.

Contributing

Welcome to contribute by creating issues or sending pull requests. See Contributing Guide for guidelines.

Who is using VirtualAPK?

License

VirtualAPK is licensed under the Apache License 2.0. See the LICENSE file.

Issues· 123 open

View all issuesOpen on GitHub
  • #403

    Establish SECURITY.md: Define Security Policy and Vulnerability Reporting

    Updated Mar 5, 2026
  • #402

    name: Build Android APK on: push: branches: - main jobs: build: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v3 - name: Set up JDK uses: actions/setup-java@v3 with: java-version: '17' distribution: 'temurin' - name: Grant execute permission for Gradlew run: chmod +x gradlew - name: Build with Gradle run: ./gradlew assembleDebug - name: Upload APK uses: actions/upload-artifact@v3 with: name: MRIPlannerApp path: app/build/outputs/apk/debug/app-debug.apk

    Updated Aug 31, 2025
  • #363

    启动插件Activity虽然启动成功了但是资源没有加载出来

    Updated Mar 24, 2025
  • #399

    Create apk of my html code

    Updated Dec 13, 2024
  • #357

    How to get commercial license?

    Updated Nov 7, 2024
  • #398

    Is it work on Android 13 , 14 ?

    Updated Oct 1, 2024
  • #393

    还维护升级吗?

    Updated May 28, 2024
  • #338

    能升级一下gradle吗?

    Updated Mar 6, 2024
  • #395

    Request

    Updated Feb 8, 2023
  • #394

    插件内跳转

    Updated Dec 5, 2022

> Tags

Java

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 29, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言