I try to establisch a HttpsURLConnection with:
HttpsURLConnection conn = (HttpsURLConnection) new URL(url).openConnection()
but I get an Exception:
E/JavaBinder( 901): java.lang.ClassCastException: org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection
But I can’t find out, why. The same example is everywhere across the web.
The ClassCastException is telling you that the object being returned is not a HttpsUrlConnection. The cast you are doing is inherently unsafe, instead you should something like:
As to the reason its not giving you an Https version, what url are you providing it with? My guess is you are giving it http:.. instead of https:…