When using Gradle to build app that contains maven artefacts stored on HTTPS servers with wildcard certificates, then this error shows: hostname in certificate didn’t match . It seams that Gradle is using Apache HttpClient library 4.2.2 which does not support SNI extensions (http://en.wikipedia.org/wiki/Server_Name_Indication). SNI extensions have been added in HttpClient library 4.3.2.
To make possible use of Gradle on HTTPS servers which use SNI, Apache HttpClient library should be upgraded to a newer version.