报错信息:

加载data报的异常

 

报错机型

等等 基本都是vivo的

解决方案:

1.重绘WebView ,确保不会直接崩溃,退出程序

 

public class VivoWebView extends WebView {    public VivoWebView(Context context) {        super(getFixedContext(context));    }    public VivoWebView(Context context, AttributeSet attrs) {        super(getFixedContext(context), attrs);    }    public VivoWebView(Context context, AttributeSet attrs, int defStyleAttr) {        super(getFixedContext(context), attrs, defStyleAttr);    }    // To fix Android Lollipop WebView problem create a new configuration on that Android version only    private static Context getFixedContext(Context context) {        if (Build.VERSION.SDK_INT == 21 || Build.VERSION.SDK_INT == 22) // Android Lollipop 5.0 & 5.1            return context.createConfigurationContext(new Configuration());        return context;    }}

2.如果出现乱码——》重新设定loadData

//这一步是针对vivo 会出现乱码的情况  小米也有几率出现webView. loadData(bean.getLabelIntroduce(), "text/html; charset=UTF-8", null);; // 加载定义的代码,并设定编码格式和字符集。

 

加载url报的错误异常:

 

解决方案:

上面第一步重写WebView,以及升级"appcompat:appcompat:1.1.0"

implementation 'androidx.appcompat:appcompat:1.1.0-beta01'

 

更多相关文章

  1. android BitmapFactory的OutOfMemoryError: bitmap size exceeds
  2. Android(安卓)异步加载深入解析
  3. Android(安卓)WebView加载H5音视频自动播放、关闭Activity停止播
  4. Android(安卓)Studio:resource android:attr/dialogCornerRadius
  5. Android(安卓)4.0 Launcher2源码分析——启动过程分析
  6. Android横竖屏加载不同布局的适配方案
  7. android增加5G热点
  8. ArcGis for Android(安卓)shp
  9. Android(安卓)WebView的使用(一)

随机推荐

  1. Android(安卓)API demos 阅读笔记 1
  2. Layout属性介绍
  3. Android(安卓)maxLine属性导致android:im
  4. Mac与Android文件传输工具 Android(安卓)
  5. 【Android】SDK手动下载
  6. android之wifi体系架构源码流程分析
  7. 在android中实现动态跑动的图表实现方法
  8. android的文件操作
  9. Android(安卓)2.1 源码结构分析
  10. Android开发常用网站