温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Android P新增检测项问题怎么修复

发布时间:2022-01-12 14:32:56 来源:亿速云 阅读:153 作者:iii 栏目:大数据

这篇文章主要讲解了“Android P新增检测项问题怎么修复”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Android P新增检测项问题怎么修复”吧!

问题原因:

Android P新增检测项问题怎么修复


commit 7c947996ca9426a8ae3abf9feb110f166d8f11daAuthor: Vladimir Marko <vmarko@google.com>Date:   Thu Apr 26 09:18:10 2018 +0100

    AOT inlined method lookup should stay within dex file.
    
    Rewrite the AOT inlined method lookup and guard against
    crossing dex file boundary. The compiler does not currently
    support inlining across dex files, so this is an indication
    of multiple dex files defining the same class and the AOT
    code having used a definition which is not used at runtime.    
    Test: m test-art-host-gtest    Test: testrunner.py --host --optimizing --jit    Test: Pixel 2 XL boots.    Test: testrunner.py --target --optimizing --jit    Bug: 74410240
    
    (cherry picked from commit 63a9f3e9e1b9fb8d98d8ca9abe626f3aa11e5692)
    
    Change-Id: Ibe9792f952d0c963b8560f10d57a951e227b24aa

从提交的日志可以看出,内敛inline应该存放在一个dex文件中,不允许跨dex文件

关于art/runtime/entrypoints/entrypoint_utils-inl.h的日志:


Android P新增检测项问题怎么修复


1、问题场景

由于国内大多数应用基本上都集成了热修复功能,所以 Android P的这个特性对国内应用影响较大。(不太理解热修复的童鞋可以参考:阿里的Android热修复技术原理.pdf)

目前发现主要有两种情况:

  • 场景一

应用原始apk中的dex A和从应用服务端下载的热修复dex B存在重复类,触发热修复且系统后台优化inline编译后,便会出现此问题。

  • 场景二

由 classloader A 加载的 class1 调用一个由 classloader B 加载的 class2里的某个 inline 方法,将导致应用闪退。

2、应用如何自检?

  • 1.首先建议应用在Android P中测试验证是否有该问题:

adb shell cmd package compile –m speed –f 应用包名 (inline编译)。
启动应用,构造热修复场景,在应用侧触发热修复。
热修复完成之后,重启应用,检测有无闪退和无响应问题。

  • 2.通过关键日志分析确认问题:

如果问题日志中有这个关键日志:This must be due to duplicate classes or playing wrongly with class loaders,可以确定就是该问题。

如下图:

06-20 19:07:24.597 30376 30376 F m.taobao.taoba:entrypoint_utils-inl.h:94]
Inlined method resolution crossed dex file boundary: 
from void com.ali.mobisecenhance.Init.doInstallCodeCoverage
(android.app.Application, android.content.Context) in/data/app/com.taobao.taobao-YPDeV7WbuyZckOfy-5AuKw==/base.apk!classes3.dex/0xece238f0to void com.ali.mobisecenhance.code.CodeCoverageEntry.CoverageInit
(android.app.Application, android.content.Context) in/data/user/0/com.taobao.taobao/files/storage/com.taobao.maindex
/dexpatch/1111/com_taobao_maindex.zip!classes4.dex/0xebda4320. 
This must be due to duplicate classes or playing wrongly with class loaders
  • 3、修复建议

    • 1.不要将ROM中预置的jar包打包至apk。

    • 2.不要使用相同的class loader加载重复类。

    • 3.如果必须要有重复类的话,避免内联现象(比如,在不期望被inline的函数里面加try catch,这样compiler就不会将此函数inline)。

感谢各位的阅读,以上就是“Android P新增检测项问题怎么修复”的内容了,经过本文的学习后,相信大家对Android P新增检测项问题怎么修复这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI