java.lang.ClassCastException: libcore.net.http.HttpURLConnectionImpl cannot be cast to javax.net.ssl.HttpsURLConnection
Method 1:
Your urlString
must begin with https://
and not http://
for you to be able to cast it to a HttpsURLConnection
.
Method 2:
if your urlString starts with http://
, changing HttpsURLConnection
to HttpURLConnection
should work