You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter favicon
at com.zhiwei.services.webapp.BaseWebActivity$mWebViewClient$1.onPageStarted(UnknownSource:12)
at com.just.agentweb.WebViewClientDelegate.onPageStarted(WebViewClientDelegate.java:80)
at com.just.agentweb.DefaultWebClient.onPageStarted(DefaultWebClient.java:466)
at xq.b(SourceFile:219)
at alW.handleMessage(SourceFile:20)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
场景:
kotlin开发环境,使用AgentWeb,在WebActivity的onCreate中,AgentWeb初始配置如下
问题
打开
WebActivity会直接崩溃,错误日志如下问题清晰描述为在
onPagestarted函数中favicon字段为空,kotlin本身调用时候认为为非空的数据,现在为空,所以引起崩溃。解决方案
如不需要特殊处理,可以移除
setWebViewClient这个初始化配置若需要使用
setWebViewClient,则需要同时设置一个useMiddlewareWebClient修改源码
DefaultWebClient原因分析:kotlin语言中若未声明
bitmap:Bitmap?为可null类型,则断定就是非空,所以如果传递的值,是null值,就会崩溃。类似Java中@NonNull标记,而AgentWeb的DefaultWebClient、WebViewClientdelegate的onPageStarted函数,都是java文件,里面未做favicon的非空判断。(似乎就是android webview的问题)综合建议:还是希望作者可以处理一下
favicon的null问题,便于更多的其他开发者使用kotlin开发时候,减少这个麻烦的处理。