java - 下拉单击时 Android Webview 崩溃
问题描述
Webview 加载但包含下拉列表。当我单击该应用程序崩溃时
Webview 直到上个月都运行良好,但现在它在所有设备中单击 webview 中的下拉菜单时崩溃。
下面附上日志。
使用的依赖项是
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation('com.google.android.material:material:1.0.0')
--------- beginning of crash
2021-06-30 16:08:03.423 19438-19438/com.dogmasystems.myrentcarbooking A/libc: Fatal signal 5 (SIGTRAP), code -6 (SI_TKILL) in tid 19438 (yrentcarbooking), pid 19438 (yrentcarbooking)
2021-06-30 16:08:03.541 21456-21456/? E/crash_dump32: unknown process state: t
2021-06-30 16:08:03.611 21456-21456/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2021-06-30 16:08:03.612 21456-21456/? A/DEBUG: Build fingerprint: 'samsung/gta3xlwifixx/gta3xlwifi:10/QP1A.190711.020/T510XXS5BUC4:user/release-keys'
2021-06-30 16:08:03.612 21456-21456/? A/DEBUG: Revision: '4'
2021-06-30 16:08:03.612 21456-21456/? A/DEBUG: ABI: 'arm'
2021-06-30 16:08:03.613 21456-21456/? A/DEBUG: Timestamp: 2021-06-30 16:08:03+0530
2021-06-30 16:08:03.613 21456-21456/? A/DEBUG: pid: 19438, tid: 19438, name: yrentcarbooking >>> com.dogmasystems.myrentcarbooking <<<
2021-06-30 16:08:03.613 21456-21456/? A/DEBUG: uid: 10316
2021-06-30 16:08:03.613 21456-21456/? A/DEBUG: signal 5 (SIGTRAP), code -6 (SI_TKILL), fault addr --------
2021-06-30 16:08:03.614 21456-21456/? A/DEBUG: Abort message: '[FATAL:jni_android.cc(306)] Please include Java exception stack in crash report
'
2021-06-30 16:08:03.614 21456-21456/? A/DEBUG: r0 00000000 r1 00000000 r2 00000000 r3 c52df784
2021-06-30 16:08:03.614 21456-21456/? A/DEBUG: r4 fff713a4 r5 c8934400 r6 fff70f5c r7 fff70f78
2021-06-30 16:08:03.614 21456-21456/? A/DEBUG: r8 eabea260 r9 0000004f r10 fff713ac r11 fff70f5c
2021-06-30 16:08:03.614 21456-21456/? A/DEBUG: ip c88d691c sp fff70f48 lr c6d5c90f pc c69045a2
2021-06-30 16:08:03.616 21456-21456/? A/DEBUG: backtrace:
2021-06-30 16:08:03.616 21456-21456/? A/DEBUG: #00 pc 017e55a2 /data/app/com.google.android.trichromelibrary_443021030-3FjkooxbSPI7iFUAICEe6A==/base.apk!libmonochrome.so (offset 0x645000) (BuildId: ea1d73db0ecf7ba0450e8051b6491bc520fd7df9)
2021-06-30 16:08:04.553 3687-3687/? E//system/bin/tombstoned: Tombstone written to: /data/tombstones/tombstone_08
2021-06-30 16:08:04.578 3534-3534/? E/audit: type=1701 audit(1625049484.575:48919): auid=4294967295 uid=10316 gid=10316 ses=4294967295 subj=u:r:untrusted_app:s0:c60,c257,c512,c768 pid=19438 comm="yrentcarbooking" exe="/system/bin/app_process32" sig=5
2021-06-30 16:08:04.624 21463-21463/? E/Zygote: isWhitelistProcess - Process is Whitelisted
2021-06-30 16:08:04.626 21463-21463/? E/Zygote: accessInfo : 1
2021-06-30 16:08:04.646 21463-21463/? E/ng.android.loo: Not starting debugger since process cannot load the jdwp agent.
2021-06-30 16:08:04.660 3993-4773/? E/InputDispatcher: channel '379536b com.dogmasystems.myrentcarbooking/com.dogmasystems.myrentcarbooking.ui.activities.WebViewActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2021-06-30 16:08:04.664 3993-4773/? E/InputDispatcher: channel 'b3e576b com.dogmasystems.myrentcarbooking/com.dogmasystems.myrentcarbooking.ui.activities.DashboardActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2021-06-30 16:08:04.725 3993-4017/? E/WindowManager: RemoteException occurs on reporting focusChanged, w=Window{379536b u0 com.dogmasystems.myrentcarbooking/com.dogmasystems.myrentcarbooking.ui.activities.WebViewActivity EXITING}
android.os.DeadObjectException
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(BinderProxy.java:575)
at android.view.IWindow$Stub$Proxy.windowFocusChanged(IWindow.java:829)
at com.android.server.wm.WindowState.reportFocusChangedSerialized(WindowState.java:3691)
at com.android.server.wm.WindowManagerService$H.handleMessage(WindowManagerService.java:5262)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.os.HandlerThread.run(HandlerThread.java:67)
at com.android.server.ServiceThread.run(ServiceThread.java:44)
解决方案
由于我没有您最终使用的 URL,但尝试了几个在其响应中有下拉列表的 URL,并且我WebView
在设备上运行良好。
我测试的设备是PIXEL 2, Samsung Galaxy S20+, S10+
这是我在项目中用于 AndroidX 的依赖项。
特别是,我建议先更新依赖项。
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
并且代码WebView
非常正常。
binding.webView.settings.apply {
// TODO Depending upon your requirement you can use these setting to be applied before loading the URL.
// javaScriptEnabled = true
// loadWithOverviewMode = true
// javaScriptCanOpenWindowsAutomatically = true
}
binding.webView.apply {
webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(
view: WebView,
url: String
): Boolean {
Log.e("url coming from server", url)
view.loadUrl(url)
return false;
}
}
loadUrl("The URL you want to load here")
}
如果它仍然无法在您的最后工作,那么您可以分享您的活动代码。
推荐阅读
- r - Shiny中的多个地块
- solr - 使用 solr 进行 Hbase 索引
- javascript - 使用 JQuery拖放到段落
- api - 它将在 Google Apps 脚本中被弃用 SpreadsheetApp
- python-3.x - 一篇文章的 Python 可读性分数(使用 Spacy)
- java - Java插入表在开始excel apache poi
- c# - 在同一个控制器中混合 MVC 和 API
- sql - 如何在 kafka 源连接器属性中配置多个查询和查询特定主题?
- machine-learning - 政策梯度行动维度
- javascript - 在并行单元中执行 javascript 函数