1

My code is standard:

options = options.transforms(CenterCrop(), RoundedCorners(3.px))
                Glide.with(itemView.context).load(flower.profilePicture.prefixHttp())
                    .apply(options)
                    .transition(
                        DrawableTransitionOptions.withCrossFade()
                    ).into(flowerImage)

I debugged and get

flower.profilePicture.prefixHttp() = http://flowrspot.s3.amazonaws.com/flowers/profile_pictures/000/000/007/medium/L_00010.jpg?1527514226

which is totally fine. I tried with multiple dependencies:

//    implementation 'com.github.bumptech.glide:glide:4.8.0'
//    kapt 'com.github.bumptech.glide:compiler:4.8.0'

    implementation 'com.github.bumptech.glide:glide:4.14.2'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'

But it just does not load. In my logcat I get some warnings/errors written:

"Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored"

"Load failed for [http://flowrspot.s3.amazonaws.com/flowers/profile_pictures/000/000/007/medium/L_00010.jpg?1527514226] with dimensions [420x525] class com.bumptech.glide.load.engine.GlideException: Failed to load resource There was 1 root cause: com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1) call GlideException#logRootCauses(String) for more detail Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, REMOTE There was 1 root cause: com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1) call GlideException#logRootCauses(String) for more detail Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Fetch failed There was 1 root cause: com.bumptech.glide.load.HttpException(Failed to connect or obtain data, status code: -1) call GlideException#logRootCauses(String) for more detail Cause (1 of 1): class com.bumptech.glide.load.HttpException: Failed to connect or obtain data, status code: -1"

What is going on here. Never seen glide behave like this...

Kratos
  • 681
  • 1
  • 13
  • 30
  • 1
    try this : `.load(flower.profilePicture.prefixHttp().replace("http","https"))` – Mouaad Abdelghafour AITALI Feb 09 '23 at 20:28
  • 1
    @MouaadAbdelghafourAITALI OMG I forgot to add android:usesCleartextTraffic="true" in manifest. Yes it is because of http, you solved it mate, thank you! If you want you can write the answer with adding android:usesCleartextTraffic="true" in manifest and I will accept it. Or otherwise if you don't I will delete question in few hours. You choose and thanks one more time <3 – Kratos Feb 09 '23 at 20:43
  • I'm glad you solved your issue. Sure, I will do that. – Mouaad Abdelghafour AITALI Feb 09 '23 at 20:57
  • 1
    Does this answer your question? [Glide not loading real image and stuck with placeholder](https://stackoverflow.com/questions/36384789/glide-not-loading-real-image-and-stuck-with-placeholder) – Halil Ozel Feb 09 '23 at 21:03

1 Answers1

1

By setting the usesCleartextTraffic attribute to true in your Android app's AndroidManifest.xml file allows the app to make network requests to HTTP (non-HTTPS) URLs.

Because, starting from Android 9 (Pie), the default value of usesCleartextTraffic is false (disabled), which means that apps are not allowed to make network requests to HTTP URLs.