Robust

  

Robust is an Android HotFix solution with high compatibility and high stability. Robust can fix bugs immediately without publishing apk.

中文说明

Environment

  • Mac Linux and Windows
  • Gradle 2.10+
  • Java 1.7 +

Usage

  1. Add below codes in the module's build.gradle.

    apply plugin: 'com.android.application'
    //please uncomment fellow line before you build a patch
    //apply plugin: 'auto-patch-plugin'
    apply plugin: 'robust'
    compile 'com.meituan.robust:robust:0.3.8'

  2. Add below codes in the outest project's build.gradle file.

     buildscript {repositories {jcenter()}dependencies {classpath 'com.meituan.robust:gradle-plugin:0.3.8'classpath 'com.meituan.robust:auto-patch-plugin:0.3.8'}
    }

  3. There are some configure items in app/robust.xml,such as classes which Robust will insert code,this may diff from projects to projects.Please copy this file to your project.

Advantages

  • Support 2.3 to 7.X Android OS
  • Perfect compatibility
  • Patch takes effect without reboot
  • Support fixing at method level,including static methods
  • Support add classes and methods
  • Suport ProGuard,including inline methods or changing methods' signure

When you build APK,you may need to save mapping.txt and files in build/outputs/robust/methodsMap.robust.

AutoPatch

AutoPatch will generate patch for Robust automatically. You just need to fellow below steps to genrate patches. For more details please visit website http://tech.meituan.com/android_autopatch.html

Steps

  1. Put 'auto-patch-plugin' just behind 'com.android.application',but in the front of others plugins。like this:

     apply plugin: 'com.android.application'apply plugin: 'auto-patch-plugin'

  2. Put mapping.txt and methodsMap.robust which are generated when you build the apks in diretory app/robust/,if not exists ,create it!

  3. After modifying the code ,please put annotation @Modify on the modified methods or invoke RobustModify.modify()(designed for Lambda Expression )in the modified methods:

       @Modifyprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);}//protected void onCreate(Bundle savedInstanceState) {RobustModify.modify()super.onCreate(savedInstanceState);}

    Use annotation @Add when you neeed to add methods or classes.

        //add method@Addpublic String getString() {return "Robust";}//add class@Addpublic class NewAddCLass {public static String get() {return "robust";}}

  4. After those steps,you need to run the same gradle command as you build the apk,then you will get patches in directory app/build/outputs/robust/patch.jar.

  5. Generating patches always end like this,which means patches is done 

Demo Usage

  1. Excute fellow command to build apk:

    ./gradlew clean  assembleRelease --stacktrace --no-daemon

  2. After install apk on your phone,you need to save mapping.txt and app/build/outputs/robust/methodsMap.robust

  3. Put mapping.txt and methodsMap.robust which are generated when you build the apks into diretory app/robust/,if directory not exists ,create it!

  4. After modifying the code ,please put annotation @Modify on the modified methods or invoke RobustModify.modify()(designed for Lambda Expression )in the modified methods.

  5. Run the same gradle command as you build the apk:

    ./gradlew clean  assembleRelease --stacktrace --no-daemon

  6. Generating patches always end like this,which means patches is done 

  7. Copy patch to your phone:

    adb push ~/Desktop/code/robust/app/build/outputs/robust/patch.jar /sdcard/robust/patch.jar

    patch directory can be configured in PatchManipulateImp.

  8. Open app,and click Patch button,patch is used.

  9. Also you can use our sample patch in app/robust/sample_patch.jar ,this dex change text after you click Jump_second_Activity Button.

  10. In the demo ,we change the text showed on the second activity which is configured in the method getTextInfo(String meituan) in class SecondActivity

Attentions

  1. You should modify inner classes' priavte constructors to public modifier.

  2. AutoPatch cannot handle situations which method returns this,you may need to wrap it like belows:

    method a(){return this;
    }

    changed to

    method a(){return new B().setThis(this).getThis();
    }

  3. Not Support add fields,but you can add classes currently, this feature is under testing.

  4. Classes added in patch should be static nested classes or non-inner classes,and all fields and methods in added class should be public.

  5. Support to fix bugs in constructors currently is under testing.

  6. Not support methods which only use fields,without method call or new expression.

  7. Support to resources and so file is under testing.

  8. For more help, please visit Wiki

Robust官方文档介绍相关推荐

  1. [HBase进阶]--rowkey设计要点(官方文档介绍)

    官方文档说明 http://hbase.apache.org/book.html#rowkey.design 一.Hotspotting(热点效应) 1.hbase是字典排序,这是一种优化扫描的方式, ...

  2. mysql如何降级_降级MySQL(参考MySQL官方文档)

    降级MySQL(参考MySQL官方文档) 介绍降级MySQL安装的步骤. 降级比升级更不常见.降级通常是由于生产系统上发生兼容性或性能问题而执行,并且在测试系统的初始升级验证期间没有发现. 与升级过程 ...

  3. ZooKeeper编程向导——源自官方文档

    ZooKeeper编程向导--源自官方文档 介绍(源自ZooKeeper官方文档) 学习HBase过程中,发现它与ZooKeeper的关系比较密切,于是专门学习了一下ZooKeeper,下面是ZooK ...

  4. 写最好的Docker安装最新版MySQL8(mysql-8.0.31)教程(参考Docker Hub和MySQL官方文档)

    一.前言   MySQL官方安装包下载地址:   https://dev.mysql.com/downloads/mysql/     Docker Hub官方网址:   https://hub.do ...

  5. Python的C语言接口 - 详解官方文档

    Python的C语言接口 - 详解官方文档 索引 Python的C语言接口 - 详解官方文档 介绍 / Introduce 代码标准 / Coding Standards 包含文件 / Include ...

  6. vue.js 2.0 官方文档学习笔记 —— 01. vue 介绍

    这是我的vue.js 2.0的学习笔记,采取了将官方文档中的代码集中到一个文件的形式.目的是保存下来,方便自己查阅. !官方文档:https://cn.vuejs.org/v2/guide/ 01. ...

  7. 每天一小时python官方文档学习(一)————python的简单介绍

    我们都知道,python的官方文档写得十分详尽,也是每一个学习python的人都绕不开的. 所以从今天开始,我每天都会用一小时学习python的官方文档,按照文档目录的顺序,摘录一些有用的语句,写下一 ...

  8. word@tips官方文档和教程@软件界面介绍@功能区自定义@拼写检查@AI润色改进@ 图片顶部上方插入文字

    文章目录 word 文档和教程 word软件界面元素 字符和标记 格式标记 段落标记(paragraph marks) 自定义功能区(Ribbon) 自定义功能区要点@层次关系 添加自定义选项卡(ta ...

  9. C#_08_官方文档_语言介绍

    C# 官方文档_C#语言介绍篇章 https://docs.microsoft.com/zh-cn/dotnet/csharp/tour-of-csharp/ C# 语言介绍 C#(读作"S ...

最新文章

  1. 递归遍历Linux下的目录文件源码实现
  2. esp32 python-ESP32及其开发板介绍
  3. MongoDB负载信息一目了然 阿里云HDM重磅发布MongoDB监控和诊断功
  4. 对称振子天线matlab程序,对称振子天线详解.ppt
  5. java手动线程池使用_Java手动配置线程池过程详解
  6. Python可视化库matplotlib(基础整理)
  7. Coinlist将在4月1日到3日举行Rally(RLY)代币销售
  8. 和“内存杀手” Chrome 说再见!新版 Edge 即将发布
  9. java提取(获取)博客信息(内容)
  10. 再起风云的社交电商,到底是穷途末路还是柳暗花明?
  11. 程序员课外拓展004:Photoshop CC 2018详细图文安装教程
  12. 二叉树的非递归遍历 C++
  13. 在百度实习的100天
  14. 打印小册子中断了怎么办
  15. 推荐一个博客:香樟小院-大宝系列,博主多年来坚持记录了一只叫大宝的野猫的生活点滴,大宝后来还有了个小宝.......
  16. idea试用许可证过期的问题
  17. 解决在nvidia官网下载巨慢的问题
  18. 人类智擒超高能中微子探秘宇宙黑洞
  19. Android File格式上传图片
  20. 3dmax插件开发环境配置及FileExport和Utilities模板测试

热门文章

  1. 「镁客早报」华为余承东欢迎苹果使用5G芯片;三星首款折叠手机本月开卖...
  2. 怎样才能让身体更加健康?
  3. 2023年上海大学文物与博物馆考研上岸前辈初复试备考经验指导
  4. namenode和datanode工作机制_NameNode与DataNode的工作原理剖析
  5. 天津滨海服务外包产业园年底投入使用
  6. 软件史上比较严重的bug案例
  7. 企业数字化转型的道法术器之我见
  8. Rust vs Pandas 数据处理
  9. 基于MATLAB的有噪声语音信号处理
  10. 基于OHCI的USB主机——UFI读容量命令(ReadCapacity)