webviewandroid-custom-viewandroid-9.0-pietargetsdkversion

AdvancedWebView (delight-im/Android-AdvancedWebView) stops showing web pages if I set targetSdkVersion 28


I'm using this WebView extension:

https://github.com/delight-im/Android-AdvancedWebView

Google Play Console is requesting a targetSdkVersion 28 for future pubblications. I tryed to update my project but the component stop showing web pages. If I set targetSdkVersion 26 everyting works normally.

Anyone is in the same situation maybe with others WebView extensions?


Solution

  • Reading the LogCat I see ERR_CLEARTEXT_NOT_PERMITTED.

    This problem is solved adding

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

    in the manifest file.

    The author (Marco) correctly says that all we need to know is already here:

    https://github.com/delight-im/Android-AdvancedWebView#cleartext-non-https-traffic

    Cleartext (non-HTTPS) traffic If you want to serve sites or just single resources over plain http instead of https, there’s usually nothing to do if you’re targeting Android 8.1 (API level 27) or earlier. On Android 9 (API level 28) and later, however, cleartext support is disabled by default. You may have to set android:usesCleartextTraffic="true" on the element in AndroidManifest.xml or provide a custom network security configuration.

    Thank you Marco!