Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

Robust

> 包管理
Open source

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

4.5K stars0 likes0 views
WebsiteGitHub

About

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

Robust

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

中文说明

More help on Wiki

Environment

  • Mac Linux and Windows
  • Gradle 2.10+ , include 3.0
  • Java 1.7 +

Usage

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

    java
    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.4.99'
  2. Add below codes in the outest project's build.gradle file.

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

java 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:

```java
   @Modify
    protected 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.

```java
    //add method
    @Add
    public String getString() {
        return "Robust";
    }
    
    //add class
    
    @Add
    public class NewAddCLass {
        public static String get() {
           return "robust";
         }
    }
```
  1. 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.
  2. Generating patches always end like this,which means patches is done

Demo Usage

  1. Excute fellow command to build apk:

    java
    ./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:

    java
    ./gradlew clean  assembleRelease --stacktrace --no-daemon
  6. Generating patches always end like this,which means patches is done

  7. Copy patch to your phone:

    java
    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' private constructors to public modifier.

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

    java
    method a(){
      return this;
    }

    changed to

    java
    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

License

Copyright 2017 Meituan-Dianping

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.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Javaandroiddynamicgradlehotfix

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category包管理
PricingOpen source

> Related tools

N
npm
Node.js 默认包管理器
P
pnpm
高效节省磁盘的 Node 包管理器
I
is-gif
Check if a Buffer/Uint8Array is a GIF image