I’m trying to make an http post request to save a user from a flutter app running on a real device. I’m running a Springboot RESTful API on an ubuntu server with nginx set up. A postman request is able to be sent. I have already tried adding android:usesCleartextTraffic="true"
to my application tag in my android manifest and I have tried adding a network_security_config
and added that to my application tag along with the meta-data tag inside the application tag.
Here is my network_security_config file:
<?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>
Here is my code for my flutter app calling the api:
Here is my Springboot RESTful API code:
2
Answers
I have figured out my issue! The issue was that I was adding android:usesCleartextTraffic="true" in the wrong android manifest file. Previously I had it under android/app/src/profile/AndroidManifest.xml but the proper spot is under andoird/app/src/debug/AndroidManifest.xml. As stated in https://flutter.dev/docs/release/breaking-changes/network-policy-ios-android
You should use
and not