0

On debug everything works fine. But if I create a releasebuild the Flutter http-libary doesn't work. I've the internet-permission in my androidmanifest. Currently I use Flutter 2.5.0 and http 0.13.3.

I've already created a new project, but it doesn't work there either.

1 Answers1

0
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:usesCleartextTraffic="true"
        android:networkSecurityConfig="@xml/network_security_config"
        android:label="Appname"
        android:icon="@mipmap/ic_launcher">

    ................
 
     </application>

Then inside res folder, create xml folder and add network_security_config.xml   
Inside network_security_config.xml file, you may enter specific http url and you may use local api also.
  
  <?xml version="1.0" encoding="utf-8"?>
   <network-security-config>
      <base-config cleartextTrafficPermitted="true">
          <trust-anchors>
              <certificates src="system" />
          </trust-anchors>
      </base-config>
      <domain-config cleartextTrafficPermitted="true">
          <domain includeSubdomains="true">example.uz</domain>
          <domain includeSubdomains="true">example2.uz</domain>
          <domain includeSubdomains="true">10.112.52.30</domain>
          <domain includeSubdomains="true">192.168.12.81</domain>
     </domain-config>
    </network-security-config>