簡體   English   中英

Android Webview 在下拉單擊時崩潰

[英]Android Webview Crash on dropdown Click

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")
}

如果它仍然無法正常工作,那么您可能可以分享您的活動代碼。

您正在調用的對象已死亡,因為其托管進程不再存在。 參考這個線程

問題 - 我正在擴展 BaseActivity 類而不是 AppCompat Activity。

由於我最近在 Base Activity 中為我的應用添加了短語,因此 Web 視圖下拉菜單崩潰了。

我只是使用下面的代碼

WebViewActivity extends AppCompatActivity

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM