问题
With android 8 and lower http request are successful but with android 9 they are failing. I have tried to enable android:usesCleartextTraffic="true" in AndroidManifest.xml . I set networkSecurityConfig like suggested in the solution found here How to allow all Network connection types HTTP in Android (9) Pie?
Try option - 1
*****AndroidManifest.Xml*****
<uses-permission android:name="android.permission.INTERNET" />
<application
.......
android:networkSecurityConfig="@xml/network_change_security">
.....
.....
</application>
*****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>
Try option - 2
<uses-permission android:name="android.permission.INTERNET" />
<application
.......
android:usesCleartextTraffic="true">
.....
.....
</application>
Try option - 3
<manifest android:targetSandboxVersion="1">
<uses-permission android:name="android.permission.INTERNET" />
...
</manifest>
来源:https://stackoverflow.com/questions/59208569/android-9-http-request-are-fail-http-request-given-me-error500-internal-serve