Convert Figma logo to code with AI

Qihoo360 logoRePlugin

RePlugin - A flexible, stable, easy-to-use Android Plug-in Framework

7,250
1,523
7,250
336

Top Related Projects

8,125

A powerful Android Dynamic Component Framework.

5,043

A small framework to split app into small parts

A powerful and lightweight plugin framework for Android

6,752

Android Signature V2 Scheme签名下的新一代渠道包打包神器

Solution to implement multi apk dynamic loading and hot fixing for Android App. (实现Android App多apk插件化和动态加载,支持资源分包和热修复)

demos to help understand plugin framwork

Quick Overview

RePlugin is an open-source Android plugin framework developed by Qihoo 360. It allows for flexible and efficient dynamic loading of components and modules in Android applications, enabling hot-swapping of code and resources without requiring app restarts or updates through app stores.

Pros

  • Highly stable and compatible, supporting Android 4.0 to 10.0 and most devices
  • Non-invasive design, allowing for easy integration into existing projects
  • Supports dynamic loading of both plugins and resources
  • Provides a high degree of isolation between host app and plugins

Cons

  • Limited documentation in English, which may pose challenges for non-Chinese speakers
  • Potential performance overhead due to dynamic loading and inter-process communication
  • Complexity in managing multiple plugins and their lifecycles
  • May require additional security considerations when loading external code

Code Examples

  1. Initializing RePlugin in the host application:
public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        RePlugin.App.onCreate();
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        RePlugin.App.attachBaseContext(this);
    }
}
  1. Loading and starting a plugin activity:
RePlugin.startActivity(context, RePlugin.createIntent("PluginName", "com.example.PluginActivity"));
  1. Invoking a plugin method:
PluginProviderClient client = RePlugin.getPluginProvider("PluginName");
Bundle bundle = client.call("MethodName", "param1", "param2");
  1. Registering a plugin:
RePlugin.registerHookingClass("PluginName", PluginHookImpl.class);

Getting Started

  1. Add RePlugin to your project's build.gradle:
dependencies {
    implementation 'com.qihoo360.replugin:replugin-host-lib:2.3.3'
}
  1. Configure RePlugin in your AndroidManifest.xml:
<application
    android:name=".MyApplication"
    android:label="@string/app_name">
    <!-- RePlugin Activities -->
    <activity android:name="com.qihoo360.replugin.sdk.RePluginActivity" />
    <activity android:name="com.qihoo360.replugin.sdk.RePluginFragmentActivity" />
</application>
  1. Initialize RePlugin in your Application class as shown in the code examples above.

  2. Create and load plugins following the RePlugin documentation and examples.

Competitor Comparisons

8,125

A powerful Android Dynamic Component Framework.

Pros of Atlas

  • More comprehensive documentation and examples
  • Better support for multi-language development (Java and Kotlin)
  • Tighter integration with Gradle build system

Cons of Atlas

  • Steeper learning curve due to more complex architecture
  • Less flexible plugin management compared to RePlugin
  • Potentially higher overhead for smaller projects

Code Comparison

Atlas:

@AtlasBundle(coverageRate = 0.8f)
public class BundleApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        // Bundle-specific initialization
    }
}

RePlugin:

public class PluginApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        RePlugin.App.onCreate();
        // Plugin-specific initialization
    }
}

Both Atlas and RePlugin are Android dynamic component frameworks, but they differ in their approach and implementation. Atlas focuses on modularization and build-time optimization, while RePlugin emphasizes runtime flexibility and ease of use.

Atlas provides a more integrated solution with the build system, making it suitable for large-scale projects with complex module dependencies. RePlugin, on the other hand, offers a simpler plugin system that can be easier to adopt for existing projects.

The code comparison shows that Atlas uses annotations to define bundles, while RePlugin relies on a more traditional plugin initialization approach. This reflects the different philosophies of the two frameworks in terms of how they manage and load dynamic components.

5,043

A small framework to split app into small parts

Pros of Small

  • Lighter weight and more flexible architecture
  • Easier integration with existing projects
  • Better support for incremental updates

Cons of Small

  • Less comprehensive documentation
  • Smaller community and fewer third-party plugins
  • May require more manual configuration

Code Comparison

Small:

Small.setBaseUri("https://example.com/updates/");
Small.setUp(this);

Small.openUri("main", this);

RePlugin:

RePlugin.App.onCreate();
RePlugin.install("plugin.apk");

RePlugin.startActivity(MainActivity.this,
    RePlugin.createIntent("plugin.apk", "com.example.PluginActivity"));

Both projects aim to provide plugin frameworks for Android applications, but they differ in their approach and implementation. Small focuses on a lightweight and flexible solution, making it easier to integrate into existing projects. RePlugin, developed by Qihoo360, offers a more robust and feature-rich framework with extensive documentation and community support.

Small's architecture allows for easier incremental updates and a more modular approach to plugin management. However, it may require more manual configuration and has less comprehensive documentation compared to RePlugin.

RePlugin provides a more complete ecosystem with better documentation and a larger community, but it may be more challenging to integrate into existing projects due to its more opinionated architecture.

A powerful and lightweight plugin framework for Android

Pros of VirtualAPK

  • Lighter weight and more flexible plugin system
  • Supports dynamic loading of resources and code without app restart
  • Better integration with Android Studio for plugin development

Cons of VirtualAPK

  • Less mature and potentially less stable than RePlugin
  • Smaller community and fewer updates compared to RePlugin
  • May require more manual configuration for complex plugin scenarios

Code Comparison

VirtualAPK plugin initialization:

PluginManager pluginManager = PluginManager.getInstance(context);
pluginManager.init();
String pluginPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/plugin.apk";
pluginManager.loadPlugin(pluginPath);

RePlugin plugin initialization:

RePlugin.App.attachBaseContext(this);
RePlugin.App.onCreate();
RePlugin.install("plugin.apk");
RePlugin.startActivity(context, RePlugin.createIntent("plugin.apk", "com.example.PluginActivity"));

Both VirtualAPK and RePlugin are Android plugin frameworks that allow for dynamic loading of components and resources. VirtualAPK offers a more lightweight approach with easier integration into existing projects, while RePlugin provides a more robust and mature ecosystem with potentially better stability for large-scale applications. The choice between the two depends on specific project requirements, desired flexibility, and the level of community support needed.

6,752

Android Signature V2 Scheme签名下的新一代渠道包打包神器

Pros of walle

  • Simpler and more lightweight solution for Android app packaging and channel distribution
  • Focuses specifically on channel packaging, making it easier to use for this purpose
  • Supports a wider range of channel packaging strategies, including custom channel information

Cons of walle

  • Limited to channel packaging and doesn't provide a full plugin framework like RePlugin
  • May require additional tools or plugins for more complex app distribution scenarios
  • Less active community and fewer updates compared to RePlugin

Code Comparison

walle:

ChannelWriter.put(new File(apkPath), channelName, extraInfo);

RePlugin:

RePlugin.registerHookingClass("com.qihoo360.replugin.sample.demo1.MainActivity",
    MainActivity.class, null);
RePlugin.startActivity(context, RePlugin.createIntent("demo1", "com.qihoo360.replugin.sample.demo1.MainActivity"));

While walle focuses on simplifying channel packaging with a single method call, RePlugin provides a more comprehensive plugin framework with methods for registering and starting plugin activities.

Solution to implement multi apk dynamic loading and hot fixing for Android App. (实现Android App多apk插件化和动态加载,支持资源分包和热修复)

Pros of DynamicAPK

  • Lightweight and simple implementation
  • Focuses specifically on dynamic loading of APK files
  • Easier to integrate into existing projects due to its simplicity

Cons of DynamicAPK

  • Less comprehensive feature set compared to RePlugin
  • Limited documentation and community support
  • Fewer options for customization and advanced use cases

Code Comparison

RePlugin:

RePlugin.install("plugin.apk");
RePlugin.startActivity(context, RePlugin.createIntent("plugin", "com.example.PluginActivity"));

DynamicAPK:

DLPluginManager.getInstance(this).loadApk(apkPath);
DLPluginManager.getInstance(this).startPluginActivity(this, new DLIntent(packageName, activityName));

Both frameworks provide similar functionality for loading and starting plugin activities, but RePlugin offers a more streamlined API. RePlugin's approach is more intuitive and requires less boilerplate code. DynamicAPK's implementation, while functional, is slightly more verbose and may require additional setup.

RePlugin generally offers more features and flexibility, making it suitable for complex projects. DynamicAPK, on the other hand, is simpler and may be preferable for smaller projects or those requiring basic dynamic loading functionality.

demos to help understand plugin framwork

Pros of understand-plugin-framework

  • More educational focus, providing detailed explanations of plugin framework concepts
  • Simpler implementation, making it easier for beginners to understand
  • Includes examples of different plugin loading techniques

Cons of understand-plugin-framework

  • Less feature-rich compared to RePlugin
  • Not as production-ready or optimized for large-scale applications
  • Limited documentation and community support

Code Comparison

understand-plugin-framework:

public class PluginClassLoader extends ClassLoader {
    private final String mDexPath;

    public PluginClassLoader(String dexPath, ClassLoader parent) {
        super(parent);
        mDexPath = dexPath;
    }
}

RePlugin:

public class PluginClassLoader extends DexClassLoader {
    private final String mPluginName;
    private final PluginCommImpl mPluginManager;

    public PluginClassLoader(String dexPath, String optimizedDirectory, String librarySearchPath, ClassLoader parent, String pluginName, PluginCommImpl pm) {
        super(dexPath, optimizedDirectory, librarySearchPath, parent);
        mPluginName = pluginName;
        mPluginManager = pm;
    }
}

The code comparison shows that RePlugin's PluginClassLoader is more complex, with additional parameters and functionality, while understand-plugin-framework's implementation is simpler and more focused on demonstrating the basic concept.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

RePlugin Logo

license

Release Version

!!!重要通知!!!

由于jcenter停服原因,RePlugin将迁移到http://maven.geelib.360.cn/nexus上

如果需要继续接入RePlugin,需要在项目的build.gradle内增加新的仓库地址:

maven {url "http://maven.geelib.360.cn/nexus/repository/replugin/"}

通知

360开源又一力作——ArgusAPM移动性能监控平台

ArgusAPM是360手机卫士客户端团队继RePlugin之后开源的又一个重量级开源项目。ArgusAPM是360移动端产品使用的可视化性能监控平台,为移动端APP提供性能监控与管理,可以迅速发现和定位各类APP性能和使用问题,帮助APP不断的提升用户体验。

360移动技术最新活动通知:

2018年12月16日,360移动性能开放日邀您参加,届时将会有360、美团技术大牛为大家分享Android、iOS性能监控实践。 欢迎报名参加,戳戳戳!!!-->https://mp.weixin.qq.com/s/-7DCnXI_EBMBwYG_PUuUDg

RePlugin —— A flexible, stable, easy-to-use Android Plug-in Framework

RePlugin is a complete Android plug-in solution which is suitable for general use.

(文档,还是中文的好)

It is major strengths are:

  • Extreme flexibility: Apps do not need to be upgraded to support new components, even brand new plug-ins.
  • Extraordinary stability: With only ONE hook (ClassLoader), NO BINDER HOOK. RePlugin’s Crash ratio is as low as Ten thousandth (0.01%). In addition, RePlugin is compatible with almost ALL Android ROMs in the market.
  • Rich features: RePlugin supports almost all features seamlessly as an installed application, including static Receiver, Task-Affinity, user-defined Theme, AppCompat, DataBinding, etc.
  • Easy integration: It takes only couple lines to access, whether plug-ins or main programs.
  • Mature management: RePlugin owns stable plug-in management solution which supports installation, upgrade, uninstallation and version management. Process communication, protocol versions and security check are also included.
  • Hundreds of millions support: RePlugin possesses hundreds of millions users from 360 MobileSafe. After more than three-year verification, we guarantee the solution that Apps use is the most stable and suitable.

By the end of June 2017, RePlugin has already made some achievements:

FeatureAchievement
Plug-in Number103
Ratio of plug-ins to applications83%
Version released pre year596
Crash0.01%, Extraordinary stability
First Release2014

At present, almost all Apps with hundreds of millions users from 360, and many mainstream third-party Apps, are using RePlugin solution.

We support:

FeatureDescription
ComponentsActivity, Service, Provider, Receiver(Including static)
Not need to upgrade when brand a new Plug-inSupported
Android FeatureSupported almost all features
TaskAffinity & Multi-ProcessPerfect supported!
Support Plug-in TypeBuilt-in (Only Two Step) and External(Download)
Plug-in CouplingBinder, Class Loader, Resources, etc.
Interprocess communicationSync, Async, Binder and Cross-plug-in broadcast
User-Defined Theme & AppComatSupported
DataBindingSupported
Safety check when installedSupported
Resources SolutionIndependent Resources + Context pass(No Adaptation ROM)
Android VersionAPI Level 9 (Android 2.3 and above)

Our Vision

Make RePlugin be used in all kinds of ordinary Apps; and provide stable, flexible, liberal plug-ins which adopt for both large and small projects.

Latest features

Solved the Android P (Android 9.0) related adaptation issues, fully support the official version of Android P (Android 9.0).

RePlugin Architecture

RePlugin Framework

How to Use RePlugin

Using RePlugin is very simple. Under most conditions, using it is no different than developing an App.

If you are the first-time user, please click here to read Quick Start Guide(Chinese Version). Following our guide, you will learn more about RePlugin.

If you wish to learn more gameplays about RePlugin, please click here to read Step-by-step Tutorial(Chinese Version).

If you want to view RePlugin’s sample project, and learn concrete usage of the frame, please click here to check Sample SC.

If you have any question, please click here to read FAQ(Chinese Version).

These apps are using RePlugin

360 Mobile Safe 360 App Store 360 Mobile Browser HuaJiao Camera 360 Clean Master
360 Kan Movie JieQianBa 1 HaiTao HuaRun Tong JieLeMa
360OS App 360 Loan (Internal App) (Internal App) (Internal App)

Plug-ins Accessed in RePlugin

For your reference, plug-ins accessed can be classified into following categories:

  • Expo plug-ins: Safe Home Page, physical examination, information flow, etc.
  • Business plug-ins: cleaning, disturbance intercept, floating window, etc.
  • Cooperation plug-ins: App Lock, free Wi-Fi, security desktop, etc.
  • Background plug-ins: Push, service management, Protobuf, etc.
  • Base plug-ins: Security WebView, share, location service, etc.

By the end of June 2017, we already have 102 plug-ins like these. We look forward to you becoming a part of RePlugin family!

Contribute Your Share

We sincerely welcome and appreciate your contribution of any kind. You can submit code, raise suggestions, write documentation, etc. For more information, please click here to read Contribute Your Share(Chinese Version).

License

RePlugin is Apache v2.0 licensed.

(Thanks Xiezihan(谢子晗) for providing the translations.)