Glide V4 load https images

I am struggling near about 1 day but find solution, if you are using ssl certified link like https then you need to add two more dependency of glide so you have to add this

implementation 'com.github.bumptech.glide:annotations:4.5.0'
kapt 'com.github.bumptech.glide:compiler:4.5.0'

I am using kotlin thats why i added kapt you can use annotationProcessor

After that you need to create GlideModule in project, so here is the code for Glide V4

public class MyGlideModule extends AppGlideModule {

    public void applyOptions(Context context, GlideBuilder builder) {
        super.applyOptions(context, builder);

    public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
        OkHttpClient okHttpClient= UnsafeOkHttpClient.getUnsafeOkHttpClient();
        registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(okHttpClient));

here we are bypass the ssl so here is the UnsafeOkHttpClient class

public class UnsafeOkHttpClient {

public static OkHttpClient getUnsafeOkHttpClient() {
    try {
        // Create a trust manager that does not validate certificate chains
        final TrustManager[] trustAllCerts = new TrustManager[] {
                new X509TrustManager() {
                    public void checkClientTrusted([] chain, String authType) throws CertificateException {

                    public void checkServerTrusted([] chain, String authType) throws CertificateException {

                    public[] getAcceptedIssuers() {
                        return new[]{};

        // Install the all-trusting trust manager
        final SSLContext sslContext = SSLContext.getInstance("SSL");
        sslContext.init(null, trustAllCerts, new;

        // Create an ssl socket factory with our all-trusting manager
        final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();

        OkHttpClient.Builder builder = new OkHttpClient.Builder();
        builder.sslSocketFactory(sslSocketFactory, (X509TrustManager)trustAllCerts[0]);
        builder.hostnameVerifier(new HostnameVerifier() {
            public boolean verify(String hostname, SSLSession session) {
                return true;

        OkHttpClient okHttpClient =;
        return okHttpClient;
    } catch (Exception e) {
        throw new RuntimeException(e);


after that you need two more class OkHttpUrlLoader and OkHttpStreamFetcher

you can copy past from Glide Link

After that final step which i am dont know thats why it will take one day so you need to build project and Glide will generate GlideApp class, so you need to use that GlideApp class to show image HTTPS like this:


I think this is very help full for others which are suffering this typeof issues. Keep Code :)