Issue
I'm create app on webview, webview load local html and style on link
Css load on android 4-8, but on android 9 css not load
Code:
StringBuilder data = new StringBuilder();
data.append("<HTML><HEAD><LINK href=\"http://example.com/style.css\" type=\"text/css\" rel=\"stylesheet\"/></HEAD><body>");
data.append(bundle.getString("content"));
data.append("</body></HTML>");
webView.loadData(data.toString(), "text/html", "UTF-8");
Solution
Try this add manifest
android:cleartextTrafficPermitted="true"
android 9 network security for this was passed. read this: https://developer.android.com/training/articles/security-config
or
<application android:networkSecurityConfig="@xml/network_security_config">
network_security_config.xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>
Answered By - Hasan Kucuk
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.