• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

VirtualAPK: VirtualAPK 是滴滴出行自研的一款优秀的插件化框架,通过将业务模块插件 ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

VirtualAPK

开源软件地址:

https://gitee.com/mirrors/virtualapk

开源软件介绍:

Android 9.0 supported! Please use the lastest release.

VirtualAPK

licenseRelease VersionPRs Welcome

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.

VirtualAPK

Supported Features

FeatureDetail
Supported componentsActivity, Service, Receiver and Provider
Manually register components in AndroidManifest.xmlNo need
Access host app classes and resourcesSupported
PendingIntentSupported
Supported Android featuresAlmost all features
CompatibilityAlmost all devices
Building systemGradle plugin
Supported Android versionsAPI Level 15+

Getting started

Host Project

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

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.

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

Initialize PluginManager in YourApplication::attachBaseContext().

@Overrideprotected 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!

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.

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

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?

滴滴出行 Uber中国

License

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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap