I am not actively working with Android so my advice may not be the best.
After reading
this note from Apache, I understand that the Android framework contains a fork of the Apache code (httpclient, httpcore, etc.), and that it has not been kept current. It seems like your code is picking up the Apache classes from the framework/SDK, and not the ones that you are specifying. According to the note, the forked code was removed in API 26, so if you have the option to move to a more recent version of the SDK, that may solve your problem.
Alternatively, you could use a different HTTP client/UA sock as
OkHttp (I have used this before). I don't think you would be able to use the latest version with API 19, but
com.squareup.okhttp3:okhttp:3.14.9 would probably work (you would need to experiment a bit).
The equivalent to what you were doing with Apache would be something like this: