Solution is
Requires Android HTTPS httpsurlconnection this class ignores certificates
1, find Universal-image-loader the library dependency package below com.nostra13.universalimageloader.core.download below the Baseimagedownloader this class
Inside the CreateConnection this method, add the following:
1 protectedhttpurlconnection createconnection (String URL, Object extra)2 throwsIOException {3 4 Try {5 httpsurlconnection6. Setdefaulthostnameverifier (Newnullhostnameverifier ());7Sslcontext sc = sslcontext.getinstance ("TLS");8Sc.init (NULL, Trustallcerts,Newsecurerandom ());9 httpsurlconnectionTen . Setdefaultsslsocketfactory (Sc.getsocketfactory ()); One}Catch(keymanagementexception e) { A e.printstacktrace (); -}Catch(nosuchalgorithmexception e) { - e.printstacktrace (); the } - -String Encodedurl =uri.encode (URL, allowed_uri_chars); -HttpURLConnection conn = (httpurlconnection)NewURL (Encodedurl) + . OpenConnection (); - conn.setconnecttimeout (connecttimeout); + conn.setreadtimeout (readtimeout); A returnConn; at}
1 Public classNullhostnameverifierImplementsHostnameverifier {2 3 @Override4 Public BooleanVerify (String hostname, sslsession session) {5LOG.I ("Restutilimpl", "Approving certificate for" +hostname);6 return true;7 }8 9}
//Create A trust manager that does not validate certificate chainstrustmanager[] Trustallcerts =NewTrustmanager[] {NewX509trustmanager () { Publicx509certificate[] Getacceptedissuers () {return NULL; } Public voidcheckclienttrusted (x509certificate[] certs, String authtype) {} Public voidcheckservertrusted (x509certificate[] certs, String authtype) {} }};
Reference Blog: http://blog.csdn.net/a102111/article/details/44311059
Need to change the jar package directly: http://download.csdn.net/detail/yang7162082/8915429
Android Open Source Framework universal-image-loader loading HTTPS pictures