記錄項目升級androidX+API29的各種坑2

前言

上篇文章記錄了幾個常見問題,然后在測試和線上的反饋中又出現(xiàn)了幾個煩人的bug

正文

問題7

問題:
Android版本 5.11報錯

android.view.InflateException: Binary XML file line #30: 
Error inflating class com.xx.xx.xx.ItemWebView(自定義的webview)
Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x2040003
    at android.content.res.Resources.getText(Resources.java:318)
    at android.content.res.VivoResources.getText(VivoResources.java:123)
    at android.content.res.Resources.getString(Resources.java:404)
    at 

解決過程:先確定是否是自定義控件造成的,后來發(fā)現(xiàn)原生view也不行,騰訊X5Webview也不行,百度google后發(fā)現(xiàn)一個連接
https://stackoverflow.com/questions/41025200/android-view-inflateexception-error-inflating-class-android-webkit-webview
關鍵詞: inflating webview String resource ID Resources.getText(這幾個混著搜)
解決方案:

目前采用以下方案
將使用webview的activity里增加

@Override
public AssetManager getAssets() {
    return getResources().getAssets();
}

補充:
google說這是他們androidX的問題,也可以通過這個人的方案

Feb-2020 update: Reverting to 1.0.2 stopped working for many people (including my app), but using the current version of androidx.appcompat:appcompat:1.2.0-alpha02 did fix the crash. (I was seeing it on a Huawei P8 Lite running Android 5.0 during Google's automated "Pre-launch report" testing).

將appcompat包升級至1.2.0-alpha02

問題8

問題:

java.lang.IllegalArgumentException: Unexpected TLS version: NONE
    at okhttp3.TlsVersion.forJavaName(TlsVersion.java:53)

解決過程:問題上說是TLS version問題,百度了下說5.0以下巴拉巴拉,可是我們檢測到在android8-android10均有問題,后來發(fā)現(xiàn)是okhttp版本過于老
解決方案:
將okHttp引用更新到3.11.0以上
連接說明https://square.github.io/okhttp/changelog_3x/#version-3110

fix bug

問題9

問題:

java.lang.NoSuchMethodError: No super method setFrame(IIII)Z in class Lcom/tencent/tbs/core/webkit/AbsoluteLayout; or its super classes (declaration of 'com.tencent.tbs.core.webkit.AbsoluteLayout' appears in /data/user/0/com.jybd.shop/app_tbs/core_share/tbs_jars_fusion_dex.jar)
    at com.tencent.tbs.core.webkit.WebView.access$701(TbsJavaCore:319)

解決過程:
android10的機子上偶現(xiàn)此bug,因為是騰訊X5包內(nèi)報錯,所以直接去官網(wǎng)搜索了
解決方案:


image.png

問題10

問題

java.lang.RuntimeException: Unable to start activity ComponentInfo
{com.xx.x/com.xx.x.x.x.activity.MainActivity}:
 androidx.fragment.app.Fragment$InstantiationException:
 Unable to instantiate fragment xx.xx.x.XFragment: 
could not find Fragment constructor

解決過程:提示could not find Fragment constructor,是沒有構造函數(shù),原因貌似是后臺殺死進程后,頁面重新恢復時報錯.原因分析來自以下連接
http://www.itdecent.cn/p/8df58655bfe3
解決方案:未解決,目前正在復現(xiàn)問題

目前先記錄這些,若遇到或者收集到新的問題,會持續(xù)更新

?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容