I was working on my code. it was working fine on version 8(Oreo) after that I got an update of android v 9.0 (Pie) and the app stopped working suddenly. after checking I got
I was also facing the same issue but After Adding the below code in my manifest file the issue got resolved
for reference you can also check this url: https://developer.android.com/about/versions/pie/android-9.0-changes-28
manifest.xml
<application
...
android:usesCleartextTraffic="true"
...>
<uses-library
android:name="org.apache.http.legacy"
android:required="false"/>
</application>
How to update the existing project in androidx.
does not need to add the extra permission & code, dependencies,...
0.1): changes into the compileSdkVersion 29
0.2): Refactor-> Migrate to androidX then
Just add the following code in the project "ASDF":
1): add the XML directory,
1.1): Add the following code in XML, Code is below: i.e.
<application
<?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>
>
2): add the following code in the in manifest file:
2.1): within application tag the (manifest->application) add the following code:
android:networkSecurityConfig="@xml/network_security_config"
2.2): outside application tag the (manifest->application) add the following code:
<application>
<uses-library
android:name="org.apache.http.legacy"
android:required="false"/>
</application>
be happy and share your feedback with me Thank you**