3

Trying to load the HTML files from assets folder, app working fine up to Android v8.1 and getting crash in Android Pie (9) devices.

Seems like WebView render process getting crash according the debug logs, finding the ways to resolve this issue.

Please help and suggest...Thanks in advance.

From the logcat:

2019-09-19 15:37:13.967 3313-3342/? E/libc: failed to connect to tombstoned: Operation not permitted
2019-09-19 15:37:14.100 4499-4499/? E/audit: type=1701 audit(1568887634.098:9979): auid=4294967295 uid=99281 gid=99281 ses=4294967295 subj=u:r:isolated_app:s0:c25,c257,c512,c768 pid=3313 comm="CrRendererMain" exe="/system/bin/app_process32" sig=5
2019-09-19 15:37:14.129 4924-4978/? E/libprocessgroup: Error encountered killing process cgroup uid 99281 pid 3313: No such file or directory
2019-09-19 15:37:14.147 3131-3131/? E/chromium: [ERROR:aw_browser_terminator.cc(125)] Renderer process (3313) crash detected (code 5).
2019-09-19 15:37:14.148 3131-3131/? A/chromium: [FATAL:crashpad_client_linux.cc(494)] Render process (3313)'s crash wasn't handled by all associated  webviews, triggering application crash.

--------- beginning of crash

2019-09-19 15:37:14.149 3131-3131/? A/libc: Fatal signal 5 (SIGTRAP), code 1 (TRAP_BRKPT), fault addr 0x726bc83a50 in tid 3131 (s.ultrasyncplus), pid 3131 (s.ultrasyncplus)
2019-09-19 15:37:14.227 3410-3410/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2019-09-19 15:37:14.227 3410-3410/? A/DEBUG: Build fingerprint: 'samsung/crownltexx/crownlte:9/PPR1.180610.011/N960FXXS3CSFC:user/release-keys'
2019-09-19 15:37:14.227 3410-3410/? A/DEBUG: Revision: '28'
2019-09-19 15:37:14.227 3410-3410/? A/DEBUG: ABI: 'arm64'
2019-09-19 15:37:14.227 3410-3410/? A/DEBUG: pid: 3131, tid: 3131, name: s.ultrasyncplus  >>> com.uhssystems.ultrasyncplus <<<
2019-09-19 15:37:14.227 3410-3410/? A/DEBUG: signal 5 (SIGTRAP), code 1 (TRAP_BRKPT), fault addr 0x726bc83a50
2019-09-19 15:37:14.227 3410-3410/? A/DEBUG: Abort message: '[FATAL:crashpad_client_linux.cc(494)] Render process (3313)'s crash wasn't handled by all associated  webviews, triggering application crash.
Rahul Khurana
  • 8,577
  • 7
  • 33
  • 60
SomeswarReddy
  • 123
  • 1
  • 3
  • 12
  • Android tombstones are not always generated. you need to enforce its generation. – Kaushik Burkule Sep 19 '19 at 10:32
  • try to set `webview.getSettings().setAllowFileAccess(true)` – Rahul Khurana Sep 19 '19 at 10:34
  • by the way these are my webview settings: mWebView.clearCache(true); settings.setJavaScriptEnabled(true); settings.setDomStorageEnabled(true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { settings.setAllowFileAccessFromFileURLs(true); settings.setAllowUniversalAccessFromFileURLs(true); }settings.setSupportZoom(false); settings.setBuiltInZoomControls(false); settings.setLoadWithOverviewMode(true); settings.setUseWideViewPort(false); settings.setAllowFileAccess(true); – SomeswarReddy Sep 19 '19 at 10:52
  • and even more: settings.setJavaScriptCanOpenWindowsAutomatically(true); settings.setCacheMode(WebSettings.LOAD_NO_CACHE); settings.setAppCacheEnabled(false); mWebView.setVerticalScrollBarEnabled(false); mWebView.setHorizontalScrollBarEnabled(false); settings.setAllowContentAccess(true); webAppInterface = new WebAppInterface(this); mWebView.addJavascriptInterface(webAppInterface, "ANDROID"); – SomeswarReddy Sep 19 '19 at 10:53

1 Answers1

-1

method 1 :This method works for all domains also with Android 9. Add this property to your Manifest like this:

 <application
    ...
   android:usesCleartextTraffic="true"
    ...>
 </application>

method 2.1 : Add @xml/network_security_config into your resources:

    <?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">www.rcub.ac.in/</domain>
    </domain-config>
</network-security-config>

2.2 : Add this security config to your Manifest like this:

<application
    ...
    android:networkSecurityConfig="@xml/network_security_config"
    ...>

    ...
</application>

You can read more in https://developer.android.com/training/articles/security-config#CleartextTrafficPermitted

SumOn
  • 306
  • 1
  • 4
  • have added above configs, unit testing the app... will keep u posted the results... – SomeswarReddy Sep 19 '19 at 10:57
  • Thanks @SumOn, your suggestions worked well for me... app running fine :) – SomeswarReddy Sep 20 '19 at 07:02
  • According to the docs, android:usesCleartextTraffic is default to false for apps that target API level 27 and it is strongly encouraged to honor this setting. The key reason for avoiding cleartext traffic is the lack of confidentiality, authenticity, and protections against tampering; a network attacker can eavesdrop on transmitted data and also modify it without being detected. https://developer.android.com/guide/topics/manifest/application-element#usesCleartextTraffic – Marafon Thiago Aug 30 '22 at 16:38