Apache HTTP client deprecation
With Android 6.0, we removed support for the Apache HTTP client. Beginning with Android 9, that library is removed from the bootclasspath and is not available to apps by default.
To continue using the Apache HTTP client, apps that target Android 9 and above can add the following to their AndroidManifest.xml:
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
Note: The android:required="false" attribute is required for apps that have a minimum SDK of 23 or lower, because on devices with API levels lower than 24, the org.apache.http.legacy library is not available. (On those devices, the Apache HTTP classes are available on the bootclasspath.)
As an alternative to using the runtime Apache library, apps can bundle their own version of the org.apache.http library in their APK. If you do this, you must repackage the library (with a utility like Jar Jar) to avoid class compatibility issues with the classes provided in the runtime.
When I added <uses-library android:name="org.apache.http.legacy" android:required="false"/> to my AndroidManfiest.xml it works as expected
I was finding that the gradle file uses a library that has been deprecated and in order to use it you have to adjust your AndroidManifest.xml
See this link:
https://developer.android.com/about/versions/pie/android-9.0-changes-28#apache-p
When I added
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
to my AndroidManfiest.xml it works as expected