首页 > 解决方案 > 单击 Samsung Galaxy Tab 9.0 版 WebView 中的 SELECT 标记会使应用程序崩溃

问题描述

我在 android 应用程序中有自定义 Webview,它打开一个包含** html 下拉列表(选择 HTML 标记)** 的网页。每当我点击这个下拉列表应用程序就崩溃了。

此崩溃发生在 Samsung Tab Android 9.0 版上,它在 Samsung Tab 7.0 版上运行良好,Google Pixel Mobile V9.0、三星移动设备 V7.0、V6.0 也运行良好。它也适用于 Tab Emulator 8.0、9.0 版。

我做了很多研究,但没有运气。过去有很多帖子,人们在使用 Android 8.0 时遇到过同样的问题,但没有合适的解决方案。

有人说这是因为我们将 ApplcationContext 传递给片段(其中包含 Webview)并建议在 XML 中添加带有 Activity 上下文的 tool:context 但它不起作用。

参考链接:-尝试在 Android WebView 中打开 SELECT 标记会使应用程序崩溃

尝试在 Android WebView 中打开 SELECT 标记会使应用程序崩溃

我没有在具有相同版本 V9.0 的任何其他品牌设备(三星除外)上尝试它,但我认为它只发生在三星 Tab 设备版本 9.0 上,因为它不会在具有相同版本的模拟器上崩溃,甚至在移动设备上也不会崩溃

所以,我不确定为什么会这样。有人可以调查一下并提供适当的解决方案。

2019-09-27 12:56:56.508
13968-13968/****************************************pe
D/InputMethodManager: startInputInner - Id : 0 2019-09-27 12:56:56.508
13968-13968/****************************************pe
I/InputMethodManager: startInputInner -
mService.startInputOrWindowGainedFocus 2019-09-27 12:56:56.512
13968-13968/****************************************pe
D/InputTransport: Input channel constructed: fd=198 2019-09-27
12:56:56.513 13968-13968/****************************************pe
D/InputTransport: Input channel destroyed: fd=171 2019-09-27
12:56:56.665 13968-13968/****************************************pe
******: android.view.InflateException: Binary XML file line #32: Binary XML file line #32: Error inflating class TextView 2019-09-27
12:56:56.666 13968-13968/****************************************pe
******: Caused by: android.view.InflateException: Binary XML file line #32: Error inflating class TextView 2019-09-27 12:56:56.668 13968-13968/****************************************pe ******: Caused
by: android.content.res.Resources$NotFoundException: Unable to find
resource ID #0x20b019d 2019-09-27 12:56:56.669
13968-13968/****************************************pe ******:     at
android.content.res.ResourcesImpl.getResourceEntryName(ResourcesImpl.java:291)
2019-09-27 12:56:56.699
13968-13968/****************************************pe ******:     at
org.chromium.content.browser.input.SelectPopup.show(PG:40) 2019-09-27
12:56:56.699 13968-13968/****************************************pe
******:     at android.os.MessageQueue.nativePollOnce(Native Method) 2019-09-27 12:56:56.699
13968-13968/****************************************pe ******:     at
android.os.MessageQueue.next(MessageQueue.java:326) 2019-09-27
12:56:56.699 13968-13968/****************************************pe
******:     at android.os.Looper.loop(Looper.java:181) 2019-09-27 12:56:56.700 13968-13968/****************************************pe
******:     at android.app.ActivityThread.main(ActivityThread.java:7179) 2019-09-27
12:56:56.700 13968-13968/****************************************pe
******:     at java.lang.reflect.Method.invoke(Native Method) 2019-09-27 12:56:56.700
13968-13968/****************************************pe ******:     at
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
2019-09-27 12:56:56.701
13968-13968/****************************************pe ******:     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
2019-09-27 12:56:56.725
13968-13968/****************************************pe A/chromium:
[FATAL:jni_android.cc(249)] Please include Java exception stack in
crash report

标签: androidhtml-tablecrashandroid-webview

解决方案


在这里,您需要在标签插入内的 manifest.xml 文件中进行更改:

android:cleartextTrafficPermitted="true"

更多有用的视频链接: webview 错误解决

当然,它会对你有所帮助。


推荐阅读