前言
上篇文章記錄了幾個常見問題,然后在測試和線上的反饋中又出現(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

問題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)搜索了
解決方案:

問題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ù)更新