在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:VirtualAPK开源软件地址:https://gitee.com/mirrors/virtualapk开源软件介绍: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 Supported Features
Getting startedHost ProjectAdd a dependency in dependencies { classpath 'com.didi.virtualapk:gradle:0.9.8.6'} Apply plugin in application module of apply plugin: 'com.didi.virtualapk.host' Compile VirtualAPK in application module of compile 'com.didi.virtualapk:core:0.9.8' Initialize @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 ProjectAdd a dependency in dependencies { classpath 'com.didi.virtualapk:gradle:0.9.8.6'} Apply plugin in application module of apply plugin: 'com.didi.virtualapk.plugin' Config VirtualAPK. Remember to put following lines at the end of 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
ContributingWelcome to contribute by creating issues or sending pull requests. See Contributing Guide for guidelines. Who is using VirtualAPK?
LicenseVirtualAPK is licensed under the Apache License 2.0. See the LICENSE file. |
请发表评论