meituan-dianping / robust Goto Github PK
View Code? Open in Web Editor NEWRobust is an Android HotFix solution with high compatibility and high stability. Robust can fix bugs immediately without a reboot.
License: Apache License 2.0
Robust is an Android HotFix solution with high compatibility and high stability. Robust can fix bugs immediately without a reboot.
License: Apache License 2.0
看过微信的 Tinker 说与加固冲突,请问你们这个呢?
是不是所有的热修付都与加固冲突?
robust修复可以添加新类吗?
/com.meituan.robust.sample E/robust: PatchsInfoImpl failed,cause ofjava.lang.ClassNotFoundException: Didn't find class "com.meituan.robust.patch.PatchesInfoImpl" on path: DexPathList[[zip file "/storage/emulated/0/robust/patch_temp.jar"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]
报这样的错误啊,在patch的时候,用的是sample例子,然后不管是debug还是release,都提示这个。可以确定得是patch.jar包中是存在com.meituan.robust.patch.PatchesInfoImpl这个的。这个jar文件也是可以确定放到正确路径下的,我是一步一步调试的,到patchsInfoClass = classLoader.loadClass(patch.getPatchesInfoImplClassFullName());这一句就抛异常了。你们在弄自己的工程时,难道没有出息类似的情况吗?
用官方的demo编译运行打一个包,查看outputs目录 ,第一次可以看到生成的methodsMap.robust文件,后面尝试手动干掉这个outputs目录,再次打包,不会自动生成methodsMap.robust文件。
怎么觉得Demo写了一堆很乱的东西,Hll,Super , State,想问有相关的文档吗,都不知道这些有什么用
Could not resolve com.meituan.gradle.mtsign:mtsign:0.0.1.
> Could not get resource 'http://depot.sankuai.com/nexus/content/groups/public/com/meituan/gradle/mtsign/mtsign/0.0.1/mtsign-0.0.1.pom'.
> Could not GET 'http://depot.sankuai.com/nexus/content/groups/public/com/meituan/gradle/mtsign/mtsign/0.0.1/mtsign-0.0.1.pom'.
> depot.sankuai.com: nodename nor servname provided, or not known
http://depot.sankuai.com/nexus/content/groups/public 这个仓库无法访问,是你们公司内部的?
逗比一下,凑人气哈
在添加完apply plugin: 'auto-patch-plugin'插件后 gradle运行同样的打包命令后总是报app:transformClassesWithAutoPatchTransformForRelease这个错误
4.Classes added in patch should not be non-static methods ,and all fields and methods in added class should be public.
Error:Plugin with id 'robust' not found.
hi,i meet the problem "patch method is empty ,please check your Modify annotation or use RobustModify.modify() to mark modified methods"when i use auto patch.but i already try to use modify annotation or RobustModify.modify() in my modify method but it is useless,can every one tell me how to resolve this proplem?
去年就看到了你们的文章,终于开源了
还未开启apply plugin: 'auto-patch-plugin'的时候,执行gradlew clean assembleRelease --stacktrace --no-daemon,报的错
================robust start================
:app:transformClassesWithRobustForRelease FAILED
FAILURE: Build failed with an exception.
No such property: Matcher for class: robust.gradle.plugin.ConvertUtils
运行后找不到robust目录,build/outputs/robust/methodsMap.robust这个文件不知道怎么生成的?
注意事项中提到的字段是指什么? 我可能是个假程序员
有一个后台补丁平台,项目才能正式集成热修复上线。
是否支持加固?
2017-03-30 20:43:52,094 - [DEBUG::robust.b::XXX.robust.b] - robustApkHash = 41072e00c519d9000afda9c5b0a60bb5
2017-03-30 20:43:52,099 - [DEBUG::robust.b::XXX.robust.b] - lcoalPath = /storage/emulated/0/XXX/app120/patch.dex
2017-03-30 20:43:52,099 - [DEBUG::XXX.robust.b::XXX.robust.b] - tmpPath = /storage/emulated/0/XXX/app120/patch
2017-03-30 20:43:52,100 - [DEBUG::XXX.robust.b::XXX.robust.b] - AppHash = null
2017-03-30 20:43:52,100 - [DEBUG::XXX.robust.b::XXX.robust.b] - LocalPath = /storage/emulated/0/XXX/app120/patch.dex.jar
2017-03-30 20:43:52,100 - [DEBUG::XXX.robust.b::XXX.robust.b] - Md5 = null
2017-03-30 20:43:52,100 - [DEBUG::v.robust.b::XXX.robust.b] - Name = 3.4.0
2017-03-30 20:43:52,101 - [DEBUG::XXX.robust.b::XXX.robust.b] - PatchesInfoImplClassFullName = com.meituan.robust.patch.PatchesnfoImpl
2017-03-30 20:43:52,101 - [DEBUG::XXX.robust.b::XXX.robust.b] - TempPath = /storage/emulated/0/XXX/app120/patch_temp.jar
2017-03-30 20:43:52,101 - [DEBUG::XXX.robust.b::XXX.robust.b] - Url = null
2017-03-30 20:43:52,102 - [DEBUG::XXX.robust.a::XXX.robust.a] - robust arrived in exceptionNotify
2017-03-30 20:43:52,105 - [DEBUG::XXX.robust.a::XXX.robust.a] - robust arrived in logNotify
2017-03-30 20:43:52,105 - [DEBUG::XXX.robust.a::XXX.robust.a] - robust arrived in onPatchApplied
这是我后台输出的关于patch.jar的相关信息 请问为什么补丁没有生效?
修复的是activity的oncreate()方法 在该方法中添加了一个Toast
依据提供的步骤配置,编译报错,参考demo没看出有啥不同。
Error:Execution failed for task ':app:transformClassesWithAutoPatchTransformForRelease'.
patch method is empty ,please check your Modify annotation or use RobustModify.modify() to mark modified methods
Caused by: java.lang.RuntimeException: patch method is empty ,please check your Modify annotation or use RobustModify.modify() to mark modified methods
outDir E:\as-demo\LeakcanaryDemo\app\build\intermediates\transforms\robust\release\folders\1\1f\main:app:processReleaseJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForRelease
:app:transformClassesAndResourcesWithProguardForRelease
ProGuard, version 5.3.2
Reading input...
Reading program directory [E:\as-demo\LeakcanaryDemo\app\build\intermediates\transforms\robust\release\folders\1\1f\main] (filtered)
Reading library jar [D:\Android\Android\sdk\platforms\android-25\android.jar]
Reading library jar [D:\Android\Android\sdk\platforms\android-25\optional\org.apache.http.legacy.jar]
Note: duplicate definition of library class [android.net.http.HttpResponseCache]
Note: duplicate definition of library class [android.net.http.SslCertificate$DName]
Note: duplicate definition of library class [android.net.http.SslError]
Note: duplicate definition of library class [android.net.http.SslCertificate]
Note: duplicate definition of library class [org.apache.http.params.CoreConnectionPNames]
Note: duplicate definition of library class [org.apache.http.params.HttpConnectionParams]
Note: duplicate definition of library class [org.apache.http.params.HttpParams]
Note: duplicate definition of library class [org.apache.http.conn.scheme.SocketFactory]
Note: duplicate definition of library class [org.apache.http.conn.scheme.LayeredSocketFactory]
Note: duplicate definition of library class [org.apache.http.conn.scheme.HostNameResolver]
Note: duplicate definition of library class [org.apache.http.conn.ConnectTimeoutException]
Note: there were 11 duplicate class definitions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
Initializing...
Warning: okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: okio.Okio: can't find referenced class java.nio.file.Files
Warning: okio.Okio: can't find referenced class java.nio.file.Files
Warning: okio.Okio: can't find referenced class java.nio.file.Files
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Note: com.google.gson.internal.UnsafeAllocator: can't find dynamically referenced class sun.misc.Unsafe
Note: com.squareup.okhttp.internal.Platform: can't find dynamically referenced class com.android.org.conscrypt.OpenSSLSocketImpl
Note: com.squareup.okhttp.internal.Platform: can't find dynamically referenced class org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl
Note: com.google.gson.internal.UnsafeAllocator accesses a declared field 'theUnsafe' dynamically
Note: there were 3 unresolved dynamic references to classes or interfaces.
You should check if you need to specify additional program jars.
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
Note: there were 1 accesses to class members by means of introspection.
You should consider explicitly keeping the mentioned class members
(using '-keep' or '-keepclassmembers').
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember)
Warning: there were 14 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForRelease FAILED
在提交issue之前,我们应该先查询是否已经有相关的issue和ReadMe中的注意事项,比如说Robust在0.3.2版本才支持windows开发。提交issue时,我们需要写明issue的原因,最好可以携带编译或运行过程的日志或者截图。issue最好以下面的格式提出:
异常类型:app运行时异常/编译异常
手机型号:如:Nexus 5(如是编译异常,则可以不填)
手机系统版本:如:Android 5.0 (如是编译异常,则可以不填)
Robust版本:如:0.3.2
Gradle版本:如:2.10
系统:如:Mac
堆栈/日志:
使用 示例中的 app
与patch.jar 报了上面的错误
和这个问题 可能一样
如题,gradlew clean assembleRelease --stacktrace --no-daemon之后 , 在outputs文件夹下面并没有mapping文件夹,更没有找到mapping.txt文件 , 是我release的方式不对么?? 求解答
混淆后首次运行gradle命令总是报错app:transformClassesWithAutoPatchTransformForRelease
Caused by: java.lang.RuntimeException: patch method is empty ,please check your Modify annotation or use RobustModify.modify() to mark modified methods
请问下,生成补丁的时候,提示如下,要肿么办。我照着demo看了好几遍了,不知道哪里搞错了。
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/2.10/userguide/gradle_daemon.html.
Register robust transform successful !!!
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:checkReleaseManifest
:app:preDebugBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2421Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72421Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2421Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCompat2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUi2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUtils2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportFragment2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportMediaCompat2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2421Library UP-TO-DATE
:app:prepareComMeituanRobustRobust030Library UP-TO-DATE
:app:prepareReleaseDependencies
:app:compileReleaseAidl
:app:compileReleaseRenderscript
:app:generateReleaseBuildConfig
:app:mergeReleaseShaders
:app:compileReleaseShaders
:app:generateReleaseAssets
:app:mergeReleaseAssets
:app:generateReleaseResValues UP-TO-DATE
:app:generateReleaseResources
:app:mergeReleaseResources
:app:processReleaseManifest
:app:processReleaseResources
:app:generateReleaseSources
:app:incrementalReleaseJavaCompilationSafeguard
:app:compileReleaseJavaWithJavac
:app:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:app:compileReleaseNdk UP-TO-DATE
:app:compileReleaseSources
:app:lintVitalRelease
:app:prePackageMarkerForRelease
:app:transformClassesWithAutoPatchTransformForRelease
================autoPatch start================
autopatch read all class file cost 0.09 second
check all class cost 0.229 second, class count: 2350
something wrong when readAnnotation, cannot find android\support\design\R$anim: android.support.design.R$anim found in android\support\design\R$anim.class cannot find class name android\support\design\R$anim
something wrong when readAnnotation, cannot find android\support\design\R$attr: android.support.design.R$attr found in android\support\design\R$attr.class cannot find class name android\support\design\R$attr
something wrong when readAnnotation, cannot find android\support\design\R$bool: android.support.design.R$bool found in android\support\design\R$bool.class cannot find class name android\support\design\R$bool
something wrong when readAnnotation, cannot find android\support\design\R$color: android.support.design.R$color found in android\support\design\R$color.class cannot find class name android\support\design\R$color
something wrong when readAnnotation, cannot find android\support\design\R$dimen: android.support.design.R$dimen found in android\support\design\R$dimen.class cannot find class name android\support\design\R$dimen
something wrong when readAnnotation, cannot find android\support\design\R$drawable: android.support.design.R$drawable found in android\support\design\R$drawable.class cannot find class name android\support\design\R$drawable
something wrong when readAnnotation, cannot find android\support\design\R$id: android.support.design.R$id found in android\support\design\R$id.class cannot find class name android\support\design\R$id
something wrong when readAnnotation, cannot find android\support\design\R$integer: android.support.design.R$integer found in android\support\design\R$integer.class cannot find class name android\support\design\R$integer
something wrong when readAnnotation, cannot find android\support\design\R$layout: android.support.design.R$layout found in android\support\design\R$layout.class cannot find class name android\support\design\R$layout
something wrong when readAnnotation, cannot find android\support\design\R$string: android.support.design.R$string found in android\support\design\R$string.class cannot find class name android\support\design\R$string
something wrong when readAnnotation, cannot find android\support\design\R$style: android.support.design.R$style found in android\support\design\R$style.class cannot find class name android\support\design\R$style
something wrong when readAnnotation, cannot find android\support\design\R$styleable: android.support.design.R$styleable found in android\support\design\R$styleable.class cannot find class name android\support\design\R$styleable
something wrong when readAnnotation, cannot find android\support\design\R: android.support.design.R found in android\support\design\R.class cannot find class name android\support\design\R
something wrong when readAnnotation, cannot find android\support\v7\appcompat\R$anim: android.support.v7.appcompat.R$anim found in android\support\v7\appcompat\R$anim.class cannot find class name android\support\v7\appcompat\R$anim
something wrong when readAnnotation, cannot find android\support\v7\appcompat\R$attr: android.support.v7.appcompat.R$attr found in android\support\v7\appcompat\R$attr.class cannot find class name android\support\v7\appcompat\R$attr
something wrong when readAnnotation, cannot find android\support\v7\appcompat\R$bool: android.support.v7.appcompat.R$bool found in android\support\v7\appcompat\R$bool.class cannot find class name android\support\v7\appcompat\R$bool
something wrong when readAnnotation, cannot find android\support\v7\appcompat\R$color: android.support.v7.appcompat.R$color found in android\support\v7\appcompat\R$color.class cannot find class name android\support\v7\appcompat\R$color
something wrong when readAnnotation, cannot find android\support\v7\appcompat\R$dimen: android.support.v7.appcompat.R$dimen found in android\support\v7\appcompat\R$dimen.class cannot find class name android\support\v7\appcompat\R$dimen
something wrong when readAnnotation, cannot find android\support\v7\appcompat\R$drawable: android.support.v7.appcompat.R$drawable found in android\support\v7\appcompat\R$drawable.class cannot find class name android\support\v7\appcompat\R$drawable
something wrong when readAnnotation, cannot find android\support\v7\appcompat\R$id: android.support.v7.appcompat.R$id found in android\support\v7\appcompat\R$id.class cannot find class name android\support\v7\appcompat\R$id
something wrong when readAnnotation, cannot find android\support\v7\appcompat\R$integer: android.support.v7.appcompat.R$integer found in android\support\v7\appcompat\R$integer.class cannot find class name android\support\v7\appcompat\R$integer
something wrong when readAnnotation, cannot find android\support\v7\appcompat\R$layout: android.support.v7.appcompat.R$layout found in android\support\v7\appcompat\R$layout.class cannot find class name android\support\v7\appcompat\R$layout
something wrong when readAnnotation, cannot find android\support\v7\appcompat\R$string: android.support.v7.appcompat.R$string found in android\support\v7\appcompat\R$string.class cannot find class name android\support\v7\appcompat\R$string
something wrong when readAnnotation, cannot find android\support\v7\appcompat\R$style: android.support.v7.appcompat.R$style found in android\support\v7\appcompat\R$style.class cannot find class name android\support\v7\appcompat\R$style
something wrong when readAnnotation, cannot find android\support\v7\appcompat\R$styleable: android.support.v7.appcompat.R$styleable found in android\support\v7\appcompat\R$styleable.class cannot find class name android\support\v7\appcompat\R$styleable
something wrong when readAnnotation, cannot find android\support\v7\appcompat\R: android.support.v7.appcompat.R found in android\support\v7\appcompat\R.class cannot find class name android\support\v7\appcompat\R
something wrong when readAnnotation, cannot find android\support\v7\recyclerview\R$attr: android.support.v7.recyclerview.R$attr found in android\support\v7\recyclerview\R$attr.class cannot find class name android\support\v7\recyclerview\R$attr
something wrong when readAnnotation, cannot find android\support\v7\recyclerview\R$dimen: android.support.v7.recyclerview.R$dimen found in android\support\v7\recyclerview\R$dimen.class cannot find class name android\support\v7\recyclerview\R$dimen
something wrong when readAnnotation, cannot find android\support\v7\recyclerview\R$id: android.support.v7.recyclerview.R$id found in android\support\v7\recyclerview\R$id.class cannot find class name android\support\v7\recyclerview\R$id
something wrong when readAnnotation, cannot find android\support\v7\recyclerview\R$styleable: android.support.v7.recyclerview.R$styleable found in android\support\v7\recyclerview\R$styleable.class cannot find class name android\support\v7\recyclerview\R$styleable
something wrong when readAnnotation, cannot find android\support\v7\recyclerview\R: android.support.v7.recyclerview.R found in android\support\v7\recyclerview\R.class cannot find class name android\support\v7\recyclerview\R
something wrong when readAnnotation, cannot find com\nanyi545\www\testrobust\BuildConfig: com.nanyi545.www.testrobust.BuildConfig found in com\nanyi545\www\testrobust\BuildConfig.class cannot find class name com\nanyi545\www\testrobust\BuildConfig
something wrong when readAnnotation, cannot find com\nanyi545\www\testrobust\MainActivity: com.nanyi545.www.testrobust.MainActivity found in com\nanyi545\www\testrobust\MainActivity.class cannot find class name com\nanyi545\www\testrobust\MainActivity
something wrong when readAnnotation, cannot find com\nanyi545\www\testrobust\R$anim: com.nanyi545.www.testrobust.R$anim found in com\nanyi545\www\testrobust\R$anim.class cannot find class name com\nanyi545\www\testrobust\R$anim
something wrong when readAnnotation, cannot find com\nanyi545\www\testrobust\R$attr: com.nanyi545.www.testrobust.R$attr found in com\nanyi545\www\testrobust\R$attr.class cannot find class name com\nanyi545\www\testrobust\R$attr
something wrong when readAnnotation, cannot find com\nanyi545\www\testrobust\R$bool: com.nanyi545.www.testrobust.R$bool found in com\nanyi545\www\testrobust\R$bool.class cannot find class name com\nanyi545\www\testrobust\R$bool
something wrong when readAnnotation, cannot find com\nanyi545\www\testrobust\R$color: com.nanyi545.www.testrobust.R$color found in com\nanyi545\www\testrobust\R$color.class cannot find class name com\nanyi545\www\testrobust\R$color
something wrong when readAnnotation, cannot find com\nanyi545\www\testrobust\R$dimen: com.nanyi545.www.testrobust.R$dimen found in com\nanyi545\www\testrobust\R$dimen.class cannot find class name com\nanyi545\www\testrobust\R$dimen
something wrong when readAnnotation, cannot find com\nanyi545\www\testrobust\R$drawable: com.nanyi545.www.testrobust.R$drawable found in com\nanyi545\www\testrobust\R$drawable.class cannot find class name com\nanyi545\www\testrobust\R$drawable
something wrong when readAnnotation, cannot find com\nanyi545\www\testrobust\R$id: com.nanyi545.www.testrobust.R$id found in com\nanyi545\www\testrobust\R$id.class cannot find class name com\nanyi545\www\testrobust\R$id
something wrong when readAnnotation, cannot find com\nanyi545\www\testrobust\R$integer: com.nanyi545.www.testrobust.R$integer found in com\nanyi545\www\testrobust\R$integer.class cannot find class name com\nanyi545\www\testrobust\R$integer
something wrong when readAnnotation, cannot find com\nanyi545\www\testrobust\R$layout: com.nanyi545.www.testrobust.R$layout found in com\nanyi545\www\testrobust\R$layout.class cannot find class name com\nanyi545\www\testrobust\R$layout
something wrong when readAnnotation, cannot find com\nanyi545\www\testrobust\R$mipmap: com.nanyi545.www.testrobust.R$mipmap found in com\nanyi545\www\testrobust\R$mipmap.class cannot find class name com\nanyi545\www\testrobust\R$mipmap
something wrong when readAnnotation, cannot find com\nanyi545\www\testrobust\R$string: com.nanyi545.www.testrobust.R$string found in com\nanyi545\www\testrobust\R$string.class cannot find class name com\nanyi545\www\testrobust\R$string
something wrong when readAnnotation, cannot find com\nanyi545\www\testrobust\R$style: com.nanyi545.www.testrobust.R$style found in com\nanyi545\www\testrobust\R$style.class cannot find class name com\nanyi545\www\testrobust\R$style
something wrong when readAnnotation, cannot find com\nanyi545\www\testrobust\R$styleable: com.nanyi545.www.testrobust.R$styleable found in com\nanyi545\www\testrobust\R$styleable.class cannot find class name com\nanyi545\www\testrobust\R$styleable
something wrong when readAnnotation, cannot find com\nanyi545\www\testrobust\R: com.nanyi545.www.testrobust.R found in com\nanyi545\www\testrobust\R.class cannot find class name com\nanyi545\www\testrobust\R
new add methods list is
new add classes list is
patchMethodSignureSet is printed below
:app:transformClassesWithAutoPatchTransformForRelease FAILED
BUILD FAILED
Total time: 16.404 secs
---------------------代码---------------------
生成补丁之前 :
@OverRide
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
生成补丁的时候
@modify
@OverRide
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Object a=new Object();
Log.i("sss","--patching--:"+a);
}
------------proguard 和demo一样-------------------------
-keep class meituan.robust.patch.**{*;}
-keep class com.google.gson.{*;}
-keep class com.meituan.robust.{*;}
-dontwarn
-keepattributes Signature,SourceFile,LineNumberTable
-keepattributes Annotation
-keeppackagenames
-ignorewarnings
-dontwarn android.support.v4.**,CompatHoneycomb,com.tenpay.android.
-optimizations !class/unboxing/enum,!code/simplification/arithmetic
------------------- gradle 2.1 + buildToolsVersion "24.0.2"+ AS 2.3 ------------------------
--------------------gradle 补丁也放在第二个了-------------------------
apply plugin: 'com.android.application'
apply plugin: 'auto-patch-plugin'
apply plugin: 'robust'
-----------------------robust.xml和demo一样 只是修改了hotfixPackage为自己的包名。 -----------------------
<switch>
<!--true代表打开Robust,这个会比较耗时建议release包在打开-->
<turnOnRobust>true</turnOnRobust>
<!--<turnOnRobust>false</turnOnRobust>-->
<!--是否开启手动模式,手动模式会去寻找配置项patchPackname包名下的所有类,自动的处理混淆,然后把patchPackname包名下的所有类制作成补丁-->
<!--<manual>true</manual>-->
<manual>false</manual>
<!--是否强制插入插入代码,Robust默认在debug模式下是关闭的,开启这个选项为true会在debug下插入代码-->
<!--<forceInsert>true</forceInsert>-->
<forceInsert>false</forceInsert>
<!--是否捕获补丁中所有反射的异常,建议上线的时候这个开关的值为true,测试的时候为false-->
<catchReflectException>true</catchReflectException>
<!--<catchReflectException>false</catchReflectException>-->
<!--是否在补丁加上log,建议上线的时候这个开关的值为false,测试的时候为true-->
<!--<patchLog>true</patchLog>-->
<patchLog>false</patchLog>
</switch>
<!--需要热补的包名或者类名,这些包名下的所有类都被会插入代码-->
<packname name="hotfixPackage">
<name>com.nanyi545.www.testrobust</name>
</packname>
<!--不需要热补的包名或者类名,可以在需要热补的包中剔除指定的类或者包-->
<exceptPackname name="exceptPackage">
<name>com.meituan.robust</name>
</exceptPackname>
<!--补丁的包名-->
<patchPackname name="patchPackname">
<name>com.meituan.robust.patch</name>
</patchPackname>
<!--自动化补丁中,不需要反射处理的类,这个配置项慎重选择-->
<noNeedReflectClass name="classes no need to reflect">
</noNeedReflectClass>
手动模式为false情况下 patchPackname 是不是不用管。。应该没有影响吧。。
配置都按照文档写的,robust.xml直接复制的demo中的,仅仅改动了hotfixPackage的包名和patchPackname的名字
build.grade 文件中加入
apply plugin: 'com.android.application'
//制作补丁时将这个打开,auto-patch-plugin紧跟着com.android.application
//apply plugin: 'auto-patch-plugin'
apply plugin: 'robust'
不知道是什么原因导致mapping.txt 生成不了,请大家指点一下!!!!!!!!!!!!!
新创建了一个项目,把robust集成进去assembleRelease并没有生成mapping.txt。
Win7 x64
/**
public class PatchManipulateImp extends PatchManipulate {
@OverRide
protected List fetchPatchList(Context context) {
//将app自己的robustApkHash上报给服务端,服务端根据robustApkHash来区分每一次apk build来给app下发补丁
//String robustApkHash = RobustApkHashUtils.readRobustApkHash(context);
Patch patch = new Patch();
patch.setName("123");
patch.setLocalPath(Environment.getExternalStorageDirectory().getPath()+ File.separator+"robust"+File.separator + "patch.dex");
patch.setTempPath(Environment.getExternalStorageDirectory().getPath()+ File.separator+"robust"+File.separator + "patch");
patch.setPatchesInfoImplClassFullName("com.meituan.robust.patch.PatchesInfoImpl");
List patches = new ArrayList();
patches.add(patch);
return patches;
}
上述中的patch.setPatchesInfoImplClassFullName中设置的是一个继承patcesInfo的类吗?我在sample和你们的文章中都没有看到此类(继承的话应该如何处理?),现在加载patch.jar时老是报exceptionNotifyDidn't find class "com.meituan.robust.patch.PatchesInfoImpl" on path: DexPathList[[],nativeLibraryDirectories=[/vendor/lib, /system/lib]] whereclass:PatchExecutor method:patch line:108
求解呀!
@OverRide
@modify
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.load).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new PatchExecutor(getApplicationContext(), new PatchManipulateImp(), new CallBack()).start();
}
});
findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, Hello(), Toast.LENGTH_SHORT).show();
Toast.makeText(MainActivity.this, Hello("test"), Toast.LENGTH_SHORT).show();
}
});
}
@Modify
public String Hello(){
return "Hello World! Hello";
}
@Add
public String Hello(String name){
return "Hello"+name;
}
java.lang.RuntimeException: patch method is empty ,please check your Modify annotation or use RobustModify.modify() to mark modified methods
at robust.gradle.plugin.AutoPatchTransform.autoPatch(AutoPatchTransform.groovy:141)
at robust.gradle.plugin.AutoPatchTransform$autoPatch.callCurrent(Unknown Source)
at robust.gradle.plugin.AutoPatchTransform.transform(AutoPatchTransform.groovy:100)
at com.android.build.api.transform.Transform.transform(Transform.java:290)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:185)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:181)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:176)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:163)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:123)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76)
Robust版本:0.3.2
Gradle版本:2.14.1
系统:Mac
Hi,我这边尝试了demo,有些困惑的地方需要咨询一下。我把补丁文件push到sdcard,点击patch之后补丁会生效。如果杀死app,重新进入重新点击patch,补丁不生效。看了源码发现在PatchExecutor类中的patch方法中会删除补丁文件。想了解这么处理的原因是什么?每次都需要从localFile 处理到tempFile么
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.