• Tencent tinker 出现pre-verified crash


    异常类型:app运行时异常
    
    手机型号:sumsung N9008
    
    手机系统版本:android4.4.2
    
    tinker版本: 1.8.1
    
    gradle版本::2.3.3
    
    是否使用热更新SDK: TinkerPatch SDK
    
    系统:如:windows
    
    堆栈/日志:
    java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
    10-20 17:26:33.541 27601-27601/? W/System.err: at com.xx.xx.c.a.d.(Unknown Source)
    10-20 17:26:33.541 27601-27601/? W/System.err: at com.xx.xx.c.a.d.a(Unknown Source)
    10-20 17:26:33.541 27601-27601/? W/System.err: at com.xx.xx.c.b.(Unknown Source)
    10-20 17:26:33.541 27601-27601/? W/System.err: at com.xx.xx.c.b.a(Unknown Source)
    10-20 17:26:33.541 27601-27601/? W/System.err: at com.xx.xx.ApplicationMy.onCreate(Unknown Source)
    10-20 17:26:33.541 27601-27601/? W/System.err: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1025)
    10-20 17:26:33.541 27601-27601/? W/System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4551)
    10-20 17:26:33.541 27601-27601/? W/System.err: at android.app.ActivityThread.access$1500(ActivityThread.java:163)
    10-20 17:26:33.541 27601-27601/? W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)
    10-20 17:26:33.541 27601-27601/? W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
    10-20 17:26:33.541 27601-27601/? W/System.err: at android.os.Looper.loop(Looper.java:157)
    10-20 17:26:33.541 27601-27601/? W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5335)
    10-20 17:26:33.541 27601-27601/? W/System.err: at java.lang.reflect.Method.invokeNative(Native Method)
    10-20 17:26:33.541 27601-27601/? W/System.err: at java.lang.reflect.Method.invoke(Method.java:515)
    10-20 17:26:33.541 27601-27601/? W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
    10-20 17:26:33.541 27601-27601/? W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
    10-20 17:26:33.541 27601-27601/? W/System.err: at dalvik.system.NativeStart.main(Native Method)
    10-20 17:26:33.541 27601-27601/? E/Debug Message - > >: 崩溃时间:2017-10-20 17:26:33
    10-20 17:26:33.541 27601-27601/? E/Debug Message - > >: 崩溃简短信息:Class ref in pre-verified class resolved to unexpected implementation
    10-20 17:26:33.541 27601-27601/? E/Debug Message - > >: 崩溃原因:null
    10-20 17:26:33.541 27601-27601/? E/Debug Message - > >: 崩溃线程名称:main崩溃线程ID:1
    10-20 17:26:33.551 27601-27615/? E/File: fail readDirectory() errno=13

    出现上述问题后一头雾水,通过log根本没有啥有用的信息,去gitHub官网上查了查有类似的问题:

    https://github.com/Tencent/tinker/issues/491

    https://github.com/Tencent/tinker/issues/151

    结合接入指南分析:https://github.com/Tencent/tinker/wiki/Tinker-%E6%8E%A5%E5%85%A5%E6%8C%87%E5%8D%97

    常见问题:https://github.com/Tencent/tinker/wiki/Tinker-%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98  (什么类需要放在主dex中)

    后得出一个猜测,可能是分包的时候一些关键类没有在main dex中,(上边问题491中有描述:注意把rxjava相关的类全部分到同一个dex(不一定要在主dex)就可以了。)

    同时接入指南中也提到了dex的keep规则

    结论:所以从tinkerpatch-sample-master (https://github.com/Tencent/tinker/tree/master/tinker-sample-android)项目中拷贝

    proguardRules.pro 修改SampleApplication为自己的applaction类

     

    tinkerMultidexKeep.pro修改SampleApplication为自己的applaction类

    到自己的项目中,syn now gradle配置文件,rebuild项目;重新打patch,大功告成

    注:1.此问题和application是否继承DefaultApplicationLike无关

      2.遇到问题:Android Studio: GC overhead limit exceeded

       解决:点击 Help > Edit Custom VM Options 以打开您的 studio.vmoptions 文件。

        填写:

        -Xms256m
        -Xmx3080m
        -XX:MaxPermSize=350m
        -XX:ReservedCodeCacheSize=225m
        -XX:+UseCompressedOops
        参见:https://stackoverflow.com/questions/35034830/android-studio-gc-overhead-limit-exceeded

       3.出现该问题的原理:http://blog.csdn.net/u010386612/article/details/51077291

       概述一下就是,dex1中的class引用了dex2中的class,导致校验失败

      4.参见:https://mp.weixin.qq.com/s?__biz=MzI1MTA1MzM2Nw==&mid=400118620&idx=1&sn=b4fdd5055731290eef12ad0d17f39d4a&scene=1&srcid=1031x2ljgSF4xJGlH1xMCJxO&uin=MjAyNzY1NTU=&key=04dce534b3b035ef58d8714d714d36bcc6cc7e136bbd64850522b491d143aafceb62c46421c5965e18876433791d16ec&devicetype=iMac%20MacBookPro12,1%20OSX%20OSX%2010.10.5%20build%2814F27%29&version=11020201&lang=zh_CN&pass_ticket=7O/VfztuLjqu23ED2WEkvy1SJstQD4eLRqX%2b%2bbCY3uE=

  • 相关阅读:
    msp430入门学习43
    msp430入门学习42
    msp430入门学习41
    msp430入门学习40
    msp430入门学习37
    msp430入门学习36
    msp430入门学习35
    JAVA三大特性之三——多态
    JAVA三大特性之二——继承
    JAVA三大特性之一——封装
  • 原文地址:https://www.cnblogs.com/androiddream/p/7755734.html
Copyright © 2020-2023  润新知