此问题已移至https://softwarerecs.stackexchange.com/questions/27841/plugins-architecture-for-an-android-app
I want to implement a plugin system for 一个开源应用程序, because it has become really large, with many features that only a few users need. Releasing different apps is not a good solution, because userA wants feature7 and feature24 whilst userB wants feature39 and feature24.
Where can I find a good example of a plugin architecture?
Here is what I would like a plugin to be able to do:
- Redefine the layout of a particular screen (加载压缩的XML?) - Redefine a method of a class (加载dex类?, AOP?)
例如,其中一个插件必须在特定屏幕上添加一个按钮,点击该按钮会增加应用程序数据库中的一个值。就我所知,这不能通过内容提供程序和意图来实现。
我希望避免使核心应用程序的代码复杂化,并到处添加大量钩子。
插件的形式可以是SD卡上的文件、应用程序或其他任何形式。