zoukankan      html  css  js  c++  java
  • 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数据块的上方:

  • 相关阅读:
    frp穿透.md
    6_模板与渲染.md
    4_多数据格式返回请求结果.md
    3_请求参数绑定与多数据格式处理.md
    5_中间件.md
    1_go_gin介绍.md
    2_Gin网络请求与路由处理.md
    14_文件.md
    firefox油猴脚本编写.md
    js 四舍五入
  • 原文地址:https://www.cnblogs.com/foundkey/p/10555107.html
Copyright © 2011-2022 走看看