Convert Figma logo to code with AI

tiann logounderstand-plugin-framework

demos to help understand plugin framwork

2,635
767
2,635
4

Top Related Projects

An app performance monitor(APM) , like "Android Studio profiler", you can easily monitor the performance of your app real time in browser

A plugin framework on android,Run any third-party apk without installation, modification or repackage

8,125

A powerful Android Dynamic Component Framework.

Android V1 and V2 Signature Channel Package Plugin

Quick Overview

The tiann/understand-plugin-framework repository is a Java-based plugin framework that allows developers to create and manage plugins for their applications. It provides a flexible and extensible architecture for building plugin-based systems, making it easier to develop and maintain complex software applications.

Pros

  • Modular Design: The plugin framework promotes a modular design, allowing developers to easily add, remove, or update individual components of the application without affecting the entire system.
  • Extensibility: The framework is designed to be highly extensible, making it easy to add new features and functionality to the application through the use of plugins.
  • Flexibility: The framework provides a high degree of flexibility, allowing developers to customize the behavior of the application to meet their specific needs.
  • Improved Maintainability: By separating the application logic into modular plugins, the codebase becomes more manageable and easier to maintain over time.

Cons

  • Complexity: The plugin framework can add a layer of complexity to the application, which may require additional development effort and expertise to set up and configure.
  • Performance Overhead: The use of a plugin framework may introduce some performance overhead, as the application needs to load and manage the various plugins.
  • Dependency Management: Developers need to carefully manage the dependencies between the application and its plugins, which can become challenging as the number of plugins grows.
  • Learning Curve: Developers who are new to the plugin framework may need to invest time in understanding its architecture and how to effectively use it in their projects.

Code Examples

Here are a few code examples demonstrating the usage of the tiann/understand-plugin-framework:

  1. Defining a Plugin:
public class MyPlugin extends Plugin {
    @Override
    public void onCreate() {
        // Initialization logic for the plugin
    }

    @Override
    public void onDestroy() {
        // Cleanup logic for the plugin
    }

    public void doSomething() {
        // Plugin-specific functionality
    }
}
  1. Registering a Plugin:
PluginManager pluginManager = PluginManager.getInstance();
pluginManager.registerPlugin(new MyPlugin());
  1. Accessing a Plugin:
MyPlugin plugin = (MyPlugin) pluginManager.getPlugin(MyPlugin.class);
plugin.doSomething();
  1. Unregistering a Plugin:
pluginManager.unregisterPlugin(MyPlugin.class);

Getting Started

To get started with the tiann/understand-plugin-framework, follow these steps:

  1. Clone the repository:
git clone https://github.com/tiann/understand-plugin-framework.git
  1. Import the project into your preferred Java IDE.

  2. Familiarize yourself with the project structure and the PluginManager class, which is the central entry point for managing plugins.

  3. Create a new plugin by extending the Plugin class and implementing the onCreate() and onDestroy() methods.

  4. Register the plugin with the PluginManager using the registerPlugin() method.

  5. Access the plugin's functionality by retrieving an instance of the plugin using the getPlugin() method.

  6. Customize the plugin framework to fit your specific application requirements, such as adding support for plugin dependencies or dynamic plugin loading.

  7. Explore the provided examples and documentation to learn more about the advanced features and capabilities of the plugin framework.

Competitor Comparisons

An app performance monitor(APM) , like "Android Studio profiler", you can easily monitor the performance of your app real time in browser

Pros of AndroidGodEye

  • AndroidGodEye provides a comprehensive set of monitoring and debugging tools for Android applications, including performance monitoring, memory usage tracking, and network traffic analysis.
  • The project has a large and active community, with regular updates and a well-documented wiki.
  • AndroidGodEye supports a wide range of Android devices and versions, making it a versatile tool for developers.

Cons of AndroidGodEye

  • The project is relatively complex and may have a steeper learning curve compared to Understand Plugin Framework.
  • AndroidGodEye may have a higher overhead on the target application, as it requires the installation of a separate agent.
  • The project's focus on monitoring and debugging may not be as relevant for developers who are primarily interested in plugin-based architectures.

Code Comparison

Understand Plugin Framework:

public class PluginManager {
    private static PluginManager instance;

    private PluginManager() {
    }

    public static PluginManager getInstance() {
        if (instance == null) {
            instance = new PluginManager();
        }
        return instance;
    }

    public void loadPlugin(String pluginPath) {
        // Load and initialize the plugin
    }
}

AndroidGodEye:

public class AndroidGodEye {
    private static AndroidGodEye instance;

    private AndroidGodEye() {
    }

    public static AndroidGodEye getInstance() {
        if (instance == null) {
            instance = new AndroidGodEye();
        }
        return instance;
    }

    public void start() {
        // Start the monitoring and debugging tools
    }
}

Both projects use a similar singleton pattern to manage the lifecycle of the main class, but the functionality and focus of the two projects are quite different.

A plugin framework on android,Run any third-party apk without installation, modification or repackage

Pros of DroidPlugin

  • Supports a wide range of Android versions, from 2.3 to 10.0.
  • Provides a comprehensive plugin management system, allowing for easy installation and removal of plugins.
  • Offers a stable and well-documented API for plugin development.

Cons of DroidPlugin

  • Requires a significant amount of setup and configuration to get started.
  • May have compatibility issues with certain Android features or libraries.
  • The project is no longer actively maintained, which could be a concern for long-term use.

Code Comparison

DroidPlugin:

PluginManager.getInstance().loadPlugin(pluginApkFile);
PluginManager.getInstance().startPlugin(pluginPackageName);

understand-plugin-framework:

PluginManager.getInstance().loadPlugin(pluginApkFile);
PluginManager.getInstance().startPlugin(pluginPackageName);

The code snippets for both DroidPlugin and understand-plugin-framework are similar, as they both provide a way to load and start a plugin. The main difference lies in the underlying implementation and the overall feature set of each framework.

8,125

A powerful Android Dynamic Component Framework.

Pros of Atlas

  • Atlas provides a more comprehensive plugin framework, supporting dynamic loading, hot-swapping, and multi-process isolation, which may be more suitable for large-scale applications.
  • Atlas has a larger community and more active development, with more features and better documentation compared to Understand Plugin Framework.
  • Atlas supports Android 4.0 and above, while Understand Plugin Framework focuses on Android 5.0 and above.

Cons of Atlas

  • Atlas has a steeper learning curve and may be more complex to set up and configure compared to Understand Plugin Framework.
  • Atlas is primarily developed and maintained by Alibaba, while Understand Plugin Framework has a smaller and more focused community.
  • Atlas may have a higher overhead and resource consumption compared to Understand Plugin Framework, which is designed to be lightweight.

Code Comparison

Understand Plugin Framework:

public class PluginManager {
    public static void loadPlugin(Context context, String pluginPath) {
        PluginLoader.getInstance().loadPlugin(context, pluginPath);
    }

    public static Object createPluginObject(String className) {
        return PluginLoader.getInstance().createPluginObject(className);
    }
}

Atlas:

public class AtlasPluginManager {
    public static void loadPlugin(Context context, String pluginPath) {
        PluginManager.getInstance().loadPlugin(context, pluginPath);
    }

    public static Object createPluginObject(String className) {
        return PluginManager.getInstance().createPluginObject(className);
    }
}

The code snippets show that both Understand Plugin Framework and Atlas provide similar APIs for loading plugins and creating plugin objects. However, the underlying implementation and feature set may differ significantly between the two frameworks.

Android V1 and V2 Signature Channel Package Plugin

Pros of VasDolly

  • VasDolly provides a comprehensive set of tools and utilities for Android app development, including a plugin framework, hot-fix solution, and more.
  • The project has a large and active community, with regular updates and a wealth of documentation and resources available.
  • VasDolly is widely used in the industry, with many real-world applications and case studies demonstrating its effectiveness.

Cons of VasDolly

  • The codebase of VasDolly is relatively complex, which may make it more challenging for newcomers to understand and contribute to the project.
  • The plugin framework in VasDolly is tightly coupled with the rest of the project, which may limit its flexibility and reusability in other contexts.

Code Comparison

Here's a brief code comparison between the two projects:

Understand Plugin Framework

public class PluginManager {
    private static PluginManager instance;

    private PluginManager() {
    }

    public static PluginManager getInstance() {
        if (instance == null) {
            instance = new PluginManager();
        }
        return instance;
    }

    public void loadPlugin(String pluginPath) {
        // Load and initialize the plugin
    }
}

VasDolly

public class PluginManager {
    private static PluginManager instance;

    private PluginManager() {
    }

    public static PluginManager getInstance() {
        if (instance == null) {
            instance = new PluginManager();
        }
        return instance;
    }

    public void loadPlugin(String pluginPath, PluginInfo pluginInfo) {
        // Load and initialize the plugin with additional metadata
    }
}

The key difference between the two implementations is that VasDolly's PluginManager accepts a PluginInfo object, which likely contains additional metadata about the plugin being loaded. This suggests that VasDolly's plugin framework is more feature-rich and supports more advanced use cases compared to the simpler Understand Plugin Framework.

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

understand-plugin-framework

分析DroidPlugin,深入理解插件化框架,内容如下:

2018/8/27 更新:

从我写下 Android插件化原理解析 系列第一篇文章至今,已经过去了两年时间。这期间,插件化技术也得到了长足的发展;与此同时,React Native,PWA,App Bundle,以及最近的Flutter也如火如荼。由于实现插件化需要太多的黑科技,它给项目的维护成本和稳定性增加了诸多不确定性;我个人认为,2017年手淘Atlas插件化项目的开源标志着插件化的落幕,2018年Android 9.0上私有API的限制几乎称得上是盖棺定论了——曾经波澜壮阔的插件化进程必将要退出历史主流。如今的插件化技术朝两个方向发展:其一,插件化的工程特性:模块化/解耦被抽离,逐渐演进为稳定、务实的的组件化方案;其二,插件化的黑科技特性被进一步发掘,inline hook/method hook大行其道,走向双开,虚拟环境等等。

虽然插件化终将落幕,但是它背后的技术原理包罗万象,值得每一个希望深入Android的小伙伴们学习。

很遗憾曾经的系列文章没有写完,现在已经没机会甚至可以说不可能去把它完结了;不过幸运的是,我的良师益友包老师(我习惯称呼他为包哥)写了一本关于插件化的书——《Android插件化开发指南》,书中讲述了过去数年浩浩荡荡的插件化历程以及插件技术的方方面面;有兴趣的小伙伴可以买一本看看。

点击购买