溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Android P新增檢測項問題怎么修復

發(fā)布時間:2022-01-12 14:32:56 來源:億速云 閱讀:168 作者:iii 欄目:大數(shù)據(jù)

這篇文章主要講解了“Android P新增檢測項問題怎么修復”,文中的講解內(nèi)容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“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

從提交的日志可以看出,內(nèi)斂inline應該存放在一個dex文件中,不允許跨dex文件

關(guān)于art/runtime/entrypoints/entrypoint_utils-inl.h的日志:


Android P新增檢測項問題怎么修復


1、問題場景

由于國內(nèi)大多數(shù)應用基本上都集成了熱修復功能,所以 Android P的這個特性對國內(nèi)應用影響較大。(不太理解熱修復的童鞋可以參考:阿里的Android熱修復技術(shù)原理.pdf)

目前發(fā)現(xiàn)主要有兩種情況:

  • 場景一

應用原始apk中的dex A和從應用服務端下載的熱修復dex B存在重復類,觸發(fā)熱修復且系統(tǒng)后臺優(yōu)化inline編譯后,便會出現(xiàn)此問題。

  • 場景二

由 classloader A 加載的 class1 調(diào)用一個由 classloader B 加載的 class2里的某個 inline 方法,將導致應用閃退。

2、應用如何自檢?

  • 1.首先建議應用在Android P中測試驗證是否有該問題:

adb shell cmd package compile –m speed –f 應用包名 (inline編譯)。
啟動應用,構(gòu)造熱修復場景,在應用側(cè)觸發(fā)熱修復。
熱修復完成之后,重啟應用,檢測有無閃退和無響應問題。

  • 2.通過關(guān)鍵日志分析確認問題:

如果問題日志中有這個關(guān)鍵日志: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.如果必須要有重復類的話,避免內(nèi)聯(lián)現(xiàn)象(比如,在不期望被inline的函數(shù)里面加try catch,這樣compiler就不會將此函數(shù)inline)。

感謝各位的閱讀,以上就是“Android P新增檢測項問題怎么修復”的內(nèi)容了,經(jīng)過本文的學習后,相信大家對Android P新增檢測項問題怎么修復這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關(guān)知識點的文章,歡迎關(guān)注!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI