插入代码如下:
捕获到以下异常:
2019-03-18 21:09:35.431 8272-8272/com.xxxx.xxxx E/AndroidRuntime: FATAL EXCEPTION: main Process: com.xxxx.xxxx, PID: 8272 java.lang.VerifyError: Verifier rejected class com.xxxx.xxxx.MainActivity: void com.xxxx.xxxx.MainActivity.downloadApp() failed to verify: void com.xxxx.xxxx.MainActivity.downloadApp(): [0x48] invalid use of move-exception (declaration of 'com.xxxx.xxxx.MainActivity' appears in /data/app/com.xxxx.xxxx-diGqKGProB4hO0iuLwrVhQ==/base.apk!classes80.dex) at java.lang.Class.newInstance(Native Method) at android.app.Instrumentation.newActivity(Instrumentation.java:1174) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:108) |
解决方案:
:catch_x伪指令必须添加在方法的末尾/也就是catch区块的代码,必须在方法的尾部,执行完异常处理逻辑后,在使用goto指令,跳转回正常流程。
如果方法中带有switch分支,那么:catch_x伪指令应该在switch数据块的上方: