1 Star 0 Fork 70

lao.wang / RePlugin

forked from replugin / RePlugin 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

RePlugin

RePlugin开源进入倒计时,今日开源!

首先非常感谢您们关注RePlugin,在前几天还没有彻底开源的前提下,能达到如此多的Star,300多个Watching,以及很多业内人士的关注,这些都出乎我们所料。在此非常感谢您们的支持!

为此,我们郑重宣布:就在今天!RePlugin在6月30日,将彻底开源!

而且我们还要补充一点:我们“绝不搞内测”,而是直接开源上线(版本是2.1.0,而非Pre版)。您们拿到的,就是这些亿级别App在用的,经过了多年验证的

再次感谢,希望大家能一如既往的支持RePlugin,无论是加Star,还是提Issue,还是未来提PR,我们都非常的欢迎。

让**“全面插件化”(无论大小项目均可使用,稳定与灵活兼得)时代**来得更猛烈一些吧!


RePlugin是一套完整的、稳定的、适合全面使用的,占坑类插件化方案。其主要优势有:

  • 极其灵活:主程序无需升级(无需在Manifest中预埋组件),即可支持新增的四大组件,甚至全新的插件
  • 非常稳定:Hook点仅有一处(ClassLoader)。其崩溃率仅为“万分之一”,并完美兼容市面上近乎所有的Android ROM
  • 特性丰富:支持近乎所有在“单品”开发时的特性。包括静态Receiver、Task-Affinity坑位、自定义Theme、进程坑位、AppCompat、DataBinding等
  • 易于集成:无论插件还是主程序,只需“数行”就能完成接入
  • 进程任意:可让各组件跑在UI、常驻,甚至是“任意坑位进程
  • 自由隔离:想隔离就隔离(如不稳定或占资源的插件,易于释放),不想隔离的模块就混用(如各种基础、UI插件,都跑在UI进程内,性能优异)
  • 管理成熟:拥有成熟稳定的“插件管理方案”,支持插件安装、升级、卸载、版本管理,甚至包括进程通讯、协议版本、安全校验等
  • 数亿支撑:有360手机卫士庞大的数亿用户做支撑,三年多的残酷验证,确保App用到的方案是最稳定、最适合使用的

支持的特性

特性 描述
支持的组件 Activity, Service, Receiver, Provider, Application
新组件无需修改主程序Manifest 支持
支持Android特性 近乎所有特性
TaskAffinity 完美支持(独创坑位方案)
多进程任意分配 支持(静态和动态均可)
插件间耦合 支持Binder、ClassLoader、资源等
自定义Theme 支持
AppComat 支持
DataBinding 支持
SO库随心用 支持
高级进程间通信 支持
跨插件资源 支持
安全校验 支持(毕竟是安全公司嘛)
PendingIntent 支持
首页也能变插件 支持
Hook点 仅一个
兼容性 几乎所有的设备
支持的android版本 API Level 9+ (2.3及以上)

截止2017年6月底,RePlugin的:

特性 描述
插件数 103个
核心插件 57个
插件占应用比 高达83%
年发版次数 高达596次
平均每日发版次数 2~3次
崩溃率 万分之一(0.01%)
时间 2014年,3年验证

目前360公司几乎所有的亿级用户量的APP,以及多款主流第三方APP,都采用了RePlugin方案。

有关RePlugin的详细介绍,请点击这里阅读《RePlugin 官方 WiKi》

愿景

让插件化能飞入寻常应用家,做到稳定、灵活、自由,大小项目兼用。

使用方法

RePlugin的使用方法非常简单,大部分情况下和“单品”开发无异。

若您是第一次接触RePlugin,则请点击这里阅读《快速上手》,跟随我们的指引,了解更多的内容。

若您想了解更多有关RePlugin的玩法,则请点击这里阅读《详细教程》,了解更多好玩的玩法。

若您想看下RePlugin的Sample工程,进而了解框架的具体用法,则请点击这里查看Sample源代码

常见问题

以下针对在Issue中提到的“最常见问题”做出回答,希望能对您有帮助。

Q:您们和360之前发的DroidPlugin的主要区别是什么?

A: 其实最主要的技术区别就一个:Hook点的多少

DroidPlugin要Hook的点非常多,好处是可以让APK“直接运行在主程序中”,但代价是失去了一定的稳定性(这点非常关键)。

相反,RePlugin只Hook了ClassLoader,所以极为稳定,且同样支持绝大多数单品的特性。而APK只需要通过我们的Gradle编译,无需开发者修改Java Code,即可运行在主程序中。但出于稳定性考虑,我们不支持(也不打算支持)“直接将APK,不经修改就放到主程序中”。

当然,还有一点,就是使用场景的不同:

DroidPlugin解决的是各个独立功能拼装在一起,能够快速发布,不需要有任何的交互。目前市面上的一些双开应用,和DroidPlugin的思路有共同之处。当然了,要做到完整的双开,则仍需要大量的修改,如Native Hook等。

RePlugin解决的是各个功能模块能独立升级,又能需要和宿主之间有一定交互。其宗旨是“允许插件少量修改,来换得最佳稳定和灵活”。

另外在项目启动时间上,RePlugin最早是2014年中旬用于360手机卫士(完整占坑类方案),DroidPlugin是2015年下旬用于360手机助手。

Q:您们是否支持DataBinding?

A: 支持。我们有几个插件在用。除此之外,我们的Sample工程,其Demo2就是用DataBinding做的,而Demo1是ButterKnife。您们可以体验一下。

Q:插件可以复用主程序的资源吗?

A: 可以的,RePlugin会同时把Host和Plugin的Context传递给插件,供开发者选择。

这块儿后续我们还会有文章来专门介绍,敬请期待。

已接入RePlugin的应用

我们诚挚期待您成为咱们RePlugin应用大家庭中的一员!

以下是RePlugin接入的应用情况(包括之前的卫士插件化框架):

  • 360 手机卫士
  • 360 手机助手
  • 360 清理大师
  • 360 影视大全
  • 360 浏览器
  • 花椒相机
  • 360OS 应用
  • 还有几个”孵化项目”

怎么都是360集团旗下的亿级别应用?当然不仅如此,我们还有一些对稳定要求极其严苛的“金融类”产品,及第三方应用,也接入了RePlugin(目前为SDK):

  • 360 借条
  • 借钱吧
  • 海淘一号
  • 华润通
  • 借了吗

其中,360手机助手App——即DroidPlugin的创始团队的应用——,现已“全面切换到RePlugin”上

这里衷心感谢 “360手机助手”,以及其它各App团队成员,帮助我们发现了很多需要改进的地方,并给予了非常积极的反馈。您们的鼓励与支持,让咱们的RePlugin能走的更远、更好!

// TODO 说好的图和链接呢?稍安勿躁

已接入RePlugin的插件

目前已有的插件,可以分为以下几类,供各App开发者参考:

  • 展示插件:如卫士首页(是的,你没看错)、体检、信息流等
  • 业务插件:如清理、骚扰拦截、悬浮窗等
  • 合作插件:如程序锁、免费WiFi、安全桌面等
  • 后台插件:如Push、服务管理、Protobuf等
  • 基础插件:如安全WebView、分享、定位等

截止2017年6月底,这样的插件,我们有103个。衷心希望您能成为这个数字中的新的一员!

贡献自己的力量

我们欢迎任何形式的贡献,并致以诚挚的感谢!

你可以贡献代码、提出问题、编写文档等。有关“贡献”相关的内容,请点击这里阅读《贡献力量》

License

RePlugin is Apache v2.0 licensed.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright (C) 2005-2017 Qihoo 360 Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

RePlugin - A flexible, stable, easy-to-use Android Plug-in Framework 展开 收起
Android
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Android
1
https://gitee.com/wangdajian/RePlugin.git
git@gitee.com:wangdajian/RePlugin.git
wangdajian
RePlugin
RePlugin
master

搜索帮助

14c37bed 8189591 565d56ea 8189591