Meituan-Dianping / Meituan-Dianping/Robust
补丁包打成功 但是在修复时Add方法出错 方法名getInfo
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.5k
- Forks
- 806
- PR merge metrics
- No merged PRs in 30d
Description
异常类型:app运行时异常
手机型号:三星S8
手机系统版本:Android 8.0
Robust版本:0.4.85
Gradle版本:4.6
系统:如:Windows
code:
public class TwoActivity extends Activity {
@SuppressLint("SetTextI18n")
@Override
@Modify
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_two);
TextView text = (TextView) findViewById(R.id.text);
text.setText("Hello " + getInfo());
}
@Add
public String getInfo(){
return "DemoTest";
}
}
堆栈/日志:
java.lang.RuntimeException: getDeclaredMethod error getInfo parameterTypes null targetObject com.project.robutdemo.TwoActivity@7db7f84
at com.meituan.robust.utils.EnhancedRobustUtils.getDeclaredMethod(EnhancedRobustUtils.java:69)
at com.meituan.robust.utils.EnhancedRobustUtils.invokeReflectMethod(EnhancedRobustUtils.java:33)
at com.project.robutdemo.TwoActivityPatch.onCreate(TwoActivityPatch.java:25)
at com.project.robutdemo.TwoActivityPatchControl.accessDispatch(PatchTemplate.java)
at com.meituan.robust.PatchProxy.accessDispatch(PatchProxy.java:94)
at com.meituan.robust.PatchProxy.proxy(PatchProxy.java:44)
at com.project.robutdemo.TwoActivity.onCreate(TwoActivity.java)
at android.app.Activity.performCreate(Activity.java:6355)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2438)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2545)
at android.app.ActivityThread.access$1100(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1396)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5597)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:771)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:649)
me: Shutting down VM
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with com.meituan.robust.utils.EnhancedRobustUtils.getDeclaredMethod and the generated com.project.robutdemo.TwoActivityPatch.onCreate shown in the stack trace. Reproduce the @Add getInfo case on the stated Android and Robust versions, then trace why reflection cannot resolve it; done means the patched onCreate runs without the getDeclaredMethod error and displays the expected result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100