Smali文件添加try/catch语句,出现“invalid use of move-exception”异常
插入代碼如下:
? ?
捕獲到以下異常:
| 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數據塊的上方:
轉載于:https://www.cnblogs.com/foundkey/p/10555107.html
總結
以上是生活随笔為你收集整理的Smali文件添加try/catch语句,出现“invalid use of move-exception”异常的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: HDU 2018 母牛的故事
- 下一篇: python基础-函数(9)