Hello, I´m trying to use Webview on my flutter App.
My problem: Webview only works with HTTPS protocol, pages with HTTP doesn´t work.// "http://www.erechim.rs.gov.br/sys530/publico"
// "https://portal.systempro.com.br:8181/sys152/login.xhtml",
Both applications are build by my company, so we are sure that java and server configurations are the same.
I already tried this setup but didn´t solve the problem:
https://medium.com/flutter-c%C3%B4te-divoire/how-to-set-up-a-basic-flutter-webview-from-a-to-z-8c659b292ec4and this one too:
http://android--kotlin.blogspot.com/2019/03/android-webview-neterrcleartextnotpermi.html@override
Widget build(BuildContext context) {
return Scaffold(
body: WebView(
initialUrl: "https://portal.systempro.com.br:8181/sys152/login.xhtml",
// "http://www.erechim.rs.gov.br/sys530/publico"
// "https://portal.systempro.com.br:8181/sys152/login.xhtml",
// "https://www.youtube.com/watch?v=tAGnKpE4NCI",
gestureNavigationEnabled: false,
debuggingEnabled: false,
javascriptMode: JavascriptMode.unrestricted,
),
);
}
AndroidManifest:
android:usesCleartextTraffic="true"
android:networkSecurityConfig="@xml/network_security_config"
android:largeHeap="true"
android:allowBackup="false"
android:supportsRtl="true">
NetworkSecurity.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>
dependencies:
dependencies:
flutter:
sdk: flutter
webview_flutter: ^0.3.19+9
Any tips for this? I´ts common to use http pages, I can´t believe I´m wasting time with this hahaha.
Best Regards from Brazil.
Bruno Zanoelo