Closed jhone666 closed 7 years ago
请问你使用的robust版本是多少?
最新的,0.4.7哦
gradle命令后面加一下 --stacktrace 帮忙看一下在哪里报错了哈~
delete
我看看哈,看起来是ReadAnnotation.groovy:30这里错了
com.xunhu.activity.SplashActivity.getShowTest() 可以多写几行吗?
嗯,我试试
delete
@Modify private String getShowTest() { int z=6+6; int y=5+5; String before="default"+z; String after="hello robust!"+y; // return before; return after; }
就这一个测试方法,应该不是方法的问题吧,会不会是哪里配置的问题?但是跟着你们文档和网上的资料走的,不知道哪里的问题@_@
你仔细看看,已经提示打补丁成功了哈
2017年9月20日 10:35,"jhone" notifications@github.com写道:
@modify https://github.com/modify private String getShowTest() { int z=6+6; int y=5+5; String before="default"+z; String after="hello robust!"+y; // return before; return after; }
就这一个测试方法,应该不是方法的问题吧,会不会是哪里配置的问题?但是跟着你们文档和网上的资料走的,不知道哪里的问题@_@
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Meituan-Dianping/Robust/issues/198#issuecomment-330728250, or mute the thread https://github.com/notifications/unsubscribe-auth/AHgyAUxlNj5EevrrHfUNlmgNqkh3Re9sks5skHnngaJpZM4PcgWz .
然后确没有patch.jar和patch.dex文件产生,只有dx.jar smali.jar basmali.jar文件产生
哦哦,可以了可以了,在outputs-》robust文件夹下,尴尬了
那么问题来了, 直接一行代码的方法是不能被修复的吗?
一行的代码会被proguard优化掉,内联到其他方法里面。可以被修复
2017年9月20日 11:24,"jhone" notifications@github.com写道:
那么问题来了, 直接一行代码的方法是不能被修复的吗?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Meituan-Dianping/Robust/issues/198#issuecomment-330734725, or mute the thread https://github.com/notifications/unsubscribe-auth/AHgyAeYJu2ryzMBsuElXgBk9SSJGeCCHks5skIV4gaJpZM4PcgWz .
我先看下源码先
这个可以自己写策略哈,可以在每次application初始化的时候就直接应用补丁
2017年9月20日 11:54,"jhone" notifications@github.com写道:
有个疑问,刚刚试过,退出应用后,得重新加载patch.jar,那不是手机本地的patch.jar不能被删除,否则就回到之前没有修复的状态了?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Meituan-Dianping/Robust/issues/198#issuecomment-330738101, or mute the thread https://github.com/notifications/unsubscribe-auth/AHgyAXelNspEvI7sD7oi8j7onOGtcMRCks5skIxtgaJpZM4PcgWz .
您好: try { patchClass = classLoader.loadClass(patchClassName); Object patchObject = patchClass.newInstance(); changeQuickRedirectField.setAccessible(true); changeQuickRedirectField.set(null, patchObject); Log.d("robust", "changeQuickRedirectField set sucess " + patchClassName); } catch (Throwable t) { Log.e("robust", "patch failed! "); t.printStackTrace(); robustCallBack.exceptionNotify(t, "class:PatchExecutor method:patch line:163"); }
问题一:看源码我只看到有filed的修改,没看到有method的修改,method的修改呢? 问题二:如果加载的两个补丁,都对methodA做了修改,那么,是后加载的补丁生效吗?覆盖? 问题三:打补丁包的时候,是否需要把上个补丁中@modify注解去掉,也就是说只在本次修改的的地方加注解 问题四:如果问题三成立,那是不是保留之前所有补丁修改过的地方的注解,结合新的修改重新生成一个补丁,那么用户只需要加载这一个补丁就可以应用所有修改了
1.源码你可以再仔细看看哈,结合我们的博客一起看看 2.会覆盖
2017年9月20日 15:07,"jhone" notifications@github.com写道:
您好: try { patchClass = classLoader.loadClass(patchClassName); Object patchObject = patchClass.newInstance(); changeQuickRedirectField.setAccessible(true); changeQuickRedirectField.set(null, patchObject); Log.d("robust", "changeQuickRedirectField set sucess " + patchClassName); } catch (Throwable t) { Log.e("robust", "patch failed! "); t.printStackTrace(); robustCallBack.exceptionNotify(t, "class:PatchExecutor method:patch line:163"); }
问题一:看源码我只看到有filed的修改,没看到有method的修改,method的修改呢? 问题二:如果加载的两个补丁,都对methodA做了修改,那么,是后加载的补丁生效吗?覆盖? 问题三:打补丁包的时候,是否需要把上个补丁中@modify https://github.com/modify注 解去掉,也就是说只在本次修改的的地方加注解 问题四:如果问题三成立,那是不是保留之前所有补丁修改过的地方的注解,结合新的修改重新生成一个补丁,那么用户只需要加载这一个补丁就可以应用所有修改了
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Meituan-Dianping/Robust/issues/198#issuecomment-330764477, or mute the thread https://github.com/notifications/unsubscribe-auth/AHgyAY_IRn3KqqJ3uLZRsnzc2plAKluUks5skLmhgaJpZM4PcgWz .
3.如果下次的改的与本次改的不是同一个class就无需保留上一次的注解。建议多个问题使用多个补丁。
2017年9月20日 15:07,"jhone" notifications@github.com写道:
您好: try { patchClass = classLoader.loadClass(patchClassName); Object patchObject = patchClass.newInstance(); changeQuickRedirectField.setAccessible(true); changeQuickRedirectField.set(null, patchObject); Log.d("robust", "changeQuickRedirectField set sucess " + patchClassName); } catch (Throwable t) { Log.e("robust", "patch failed! "); t.printStackTrace(); robustCallBack.exceptionNotify(t, "class:PatchExecutor method:patch line:163"); }
问题一:看源码我只看到有filed的修改,没看到有method的修改,method的修改呢? 问题二:如果加载的两个补丁,都对methodA做了修改,那么,是后加载的补丁生效吗?覆盖? 问题三:打补丁包的时候,是否需要把上个补丁中@modify https://github.com/modify注 解去掉,也就是说只在本次修改的的地方加注解 问题四:如果问题三成立,那是不是保留之前所有补丁修改过的地方的注解,结合新的修改重新生成一个补丁,那么用户只需要加载这一个补丁就可以应用所有修改了
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Meituan-Dianping/Robust/issues/198#issuecomment-330764477, or mute the thread https://github.com/notifications/unsubscribe-auth/AHgyAY_IRn3KqqJ3uLZRsnzc2plAKluUks5skLmhgaJpZM4PcgWz .
4.可以把所有的都放在一个补丁解决,但是建议多个问题使用多个补丁。便于测试与管理。
2017年9月20日 15:07,"jhone" notifications@github.com写道:
您好: try { patchClass = classLoader.loadClass(patchClassName); Object patchObject = patchClass.newInstance(); changeQuickRedirectField.setAccessible(true); changeQuickRedirectField.set(null, patchObject); Log.d("robust", "changeQuickRedirectField set sucess " + patchClassName); } catch (Throwable t) { Log.e("robust", "patch failed! "); t.printStackTrace(); robustCallBack.exceptionNotify(t, "class:PatchExecutor method:patch line:163"); }
问题一:看源码我只看到有filed的修改,没看到有method的修改,method的修改呢? 问题二:如果加载的两个补丁,都对methodA做了修改,那么,是后加载的补丁生效吗?覆盖? 问题三:打补丁包的时候,是否需要把上个补丁中@modify https://github.com/modify注 解去掉,也就是说只在本次修改的的地方加注解 问题四:如果问题三成立,那是不是保留之前所有补丁修改过的地方的注解,结合新的修改重新生成一个补丁,那么用户只需要加载这一个补丁就可以应用所有修改了
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Meituan-Dianping/Robust/issues/198#issuecomment-330764477, or mute the thread https://github.com/notifications/unsubscribe-auth/AHgyAY_IRn3KqqJ3uLZRsnzc2plAKluUks5skLmhgaJpZM4PcgWz .
好的,多谢
生成patch步骤时编译出错 Executing tasks: [assembleRelease]
Configuration on demand is an incubating feature. NDK is missing a "platforms" directory. If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to D:\myinstall\asSDK\ndk-bundle. If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
Register robust transform successful !!! Incremental java compilation is an incubating feature. :app:preBuild UP-TO-DATE :app:extractProguardFiles :app:preReleaseBuild :app:checkReleaseManifest :app:preDebugBuild UP-TO-DATE :app:prepareComAndroidSupportAnimatedVectorDrawable2531Library :app:prepareComAndroidSupportAppcompatV72531Library :app:prepareComAndroidSupportSupportCompat2531Library :app:prepareComAndroidSupportSupportCoreUi2531Library :app:prepareComAndroidSupportSupportCoreUtils2531Library :app:prepareComAndroidSupportSupportFragment2531Library :app:prepareComAndroidSupportSupportMediaCompat2531Library :app:prepareComAndroidSupportSupportV42531Library :app:prepareComAndroidSupportSupportVectorDrawable2531Library :app:prepareComMeituanRobustRobust047Library :app:prepareReleaseDependencies :app:compileReleaseAidl UP-TO-DATE :app:compileReleaseRenderscript UP-TO-DATE :app:generateReleaseBuildConfig UP-TO-DATE :app:generateReleaseResValues UP-TO-DATE :app:generateReleaseResources UP-TO-DATE :app:mergeReleaseResources UP-TO-DATE :app:processReleaseManifest UP-TO-DATE :app:processReleaseResources UP-TO-DATE :app:generateReleaseSources UP-TO-DATE :app:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE :app:javaPreCompileRelease :app:compileReleaseJavaWithJavac UP-TO-DATE :app:compileReleaseNdk UP-TO-DATE :app:compileReleaseSources UP-TO-DATE :app:lintVitalRelease :app:mergeReleaseShaders UP-TO-DATE :app:compileReleaseShaders UP-TO-DATE :app:generateReleaseAssets UP-TO-DATE :app:mergeReleaseAssets UP-TO-DATE :app:transformClassesWithAutoPatchTransformForRelease ================autoPatch start================ autopatch read all class file cost 0.009 second check all class cost 0.068 second, class count: 1703 addPatchMethodAndModifiedClass pint methodmap key is com.xunhu.activity.SplashActivity.initEvent() value is 7 key is com.xunhu.activity.SplashActivity$Callback.onPatchFetched(boolean,boolean,com.meituan.robust.Patch) value is 2 key is com.xunhu.activity.SplashActivity.onClickEvent(android.view.View) value is 8 key is com.xunhu.activity.SplashActivity$Callback.onPatchListFetched(boolean,boolean,java.util.List) value is 1 key is com.xunhu.activity.SplashActivity$Callback.logNotify(java.lang.String,java.lang.String) value is 4 key is com.xunhu.activity.SplashActivity.init() value is 6 key is com.xunhu.activity.SplashActivity$Callback.onPatchApplied(boolean,com.meituan.robust.Patch) value is 3 key is com.xunhu.activity.SplashActivity$Callback.exceptionNotify(java.lang.Throwable,java.lang.String) value is 5
:app:transformClassesWithAutoPatchTransformForRelease FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:transformClassesWithAutoPatchTransformForRelease'.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1.354 secs
然后robust目录下生成的了dx.jar 、 baksmali-2.1.2.jar 、smali-2.1.2.jar三个文件,没有生成patch.jar和patch.dex 这是为什么呢?