applyplugin: 'com.android.application'//please uncomment fellow line before you build a patch//apply plugin: 'auto-patch-plugin'applyplugin: 'robust'compile'com.meituan.robust:robust:0.4.99'
Add below codes in the outest project's build.gradle file.
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 10 Android OS
Perfect compatibility
Patch takes effect without a reboot
Support fixing at method level,including static methods
Support add classes and methods
Support ProGuard,including inline methods or changing methods' signature
When you build APK,you may need to save "mapping.txt" and the files in directory "build/outputs/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
Put 'auto-patch-plugin' just behind 'com.android.application',but in the front of others plugins。like this:
Put mapping.txt and methodsMap.robust which are generated when you build the apks in diretory app/robust/,if not exists ,create it!
After modifying the code ,please put annotation @Modify on the modified methods or invoke RobustModify.modify() (designed for Lambda Expression )in the modified methods:
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.
Generating patches always end like this,which means patches is done
After install apk on your phone,you need to save mapping.txt and app/build/outputs/robust/methodsMap.robust
Put mapping.txt and methodsMap.robust which are generated when you build the apks into diretory app/robust/,if directory not exists ,create it!
After modifying the code ,please put annotation @Modify on the modified methods or invoke RobustModify.modify() (designed for Lambda Expression )in the modified methods.
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.
请发表评论