Android 9 Http request are fail, Http Request given me error(500 internal serve error)

一世执手 提交于 2020-02-23 06:44:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!