相关疑难解决方法(0)

java.lang.IllegalArgumentException:对于Kotlin和WebView,指定为非null的参数为null

我试图用自定义HTML字符串填充我的WebView并尝试在未加载时显示进度,并在完成时隐藏它.

这是我的代码:

webView.settings.javaScriptEnabled = true
webView.loadDataWithBaseURL(null, presentation.content, "text/html", "utf-8", null)

webView.webViewClient = object : WebViewClient() {

  override fun onPageStarted(view: WebView, url: String, favicon: Bitmap) {
    super.onPageStarted(view, url, favicon)
    webViewProgressBar.visibility = ProgressBar.VISIBLE
    webView.visibility = View.INVISIBLE
  }

  override fun onPageCommitVisible(view: WebView, url: String) {
    super.onPageCommitVisible(view, url)
    webViewProgressBar.visibility = ProgressBar.GONE
    webView.visibility = View.VISIBLE
  }
}
Run Code Online (Sandbox Code Playgroud)

我收到此错误,这不是指向我的代码的任何行:

E/AndroidRuntime:致命异常:主要

java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter favicon
at com.hidglobal.tmt.app.mobiBadge.ui.presentation.PresentationActivity$showPresentation$1.onPageStarted(PresentationActivity.kt)
at com.android.webview.chromium.WebViewContentsClientAdapter.onPageStarted(WebViewContentsClientAdapter.java:215)
at org.chromium.android_webview.AwContentsClientCallbackHelper$MyHandler.handleMessage(AwContentsClientCallbackHelper.java:20)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method) …
Run Code Online (Sandbox Code Playgroud)

android android-webview kotlin

7
推荐指数
2
解决办法
3890
查看次数

标签 统计

android ×1

android-webview ×1

kotlin ×1