1

at the moment I have some trouble with Glide and android devices above 8+.

My Problem:

Inside a Adapter (RecyclerView) I want to bind a image (located on a public available server / url) with Glide. For devices lower android 8, glide works without problems and load the images into the imageview.

On devices (8+) Glide not working correctly. No images are loading into the imageview.

Inside the logcat I don´t get error messages or somethinge else.

I use the newest Android Studio and the dependencies are all up-to-date (Androidx).

My Glide Code (without custom configs):

 GlideApp.with(activity)
            .load(feedItem.getThumbnail())
            .error(R.drawable.error)
            .transition(DrawableTransitionOptions.withCrossFade(2000))
            .into(feedListRowHolder.listview_thumbnail); 

Gradle File:

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'com.jakewharton.threetenabp:threetenabp:1.2.4'
    implementation 'com.github.bumptech.glide:glide:4.11.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
 //   implementation 'com.github.bumptech.glide:okhttp3-integration:4.11.0'
    implementation 'com.squareup.okhttp3:okhttp:4.7.2'
    implementation 'com.getkeepsafe.taptargetview:taptargetview:1.11.0'
    // androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.core:core:1.3.0'
    implementation 'com.google.android.gms:play-services-safetynet:17.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.gridlayout:gridlayout:1.0.0'
    implementation 'androidx.lifecycle:lifecycle-livedata-core:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-livedata:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation "androidx.room:room-runtime:$rootProject.roomVersion"
    annotationProcessor "androidx.room:room-compiler:$rootProject.roomVersion"
    annotationProcessor "androidx.annotation:annotation:1.1.0"
    androidTestImplementation "androidx.room:room-testing:$rootProject.roomVersion"
    implementation 'androidx.navigation:navigation-fragment:2.2.2'
    implementation 'androidx.navigation:navigation-ui:2.2.2'
}

I comment the okhttp integration for glide, because these library have no effect.

Can somebody help me to sole my problem? (Did you need more lines of Code?)

Edit and solution: As I mention in my last comment, after adding following two methods , glide works as aspected:

GlideApp.with(activity)
             .asBitmap()
            .load(feedItem.getThumbnail())
            .placeholder(R.drawable.placeholder)
            .error(R.drawable.error)
            .transition(DrawableTransitionOptions.withCrossFade(2000))
            .into(feedListRowHolder.listview_thumbnail); 
Zoe
  • 27,060
  • 21
  • 118
  • 148
Developer2as
  • 85
  • 1
  • 1
  • 8
  • Is is `http` or `https` image? Do you have some `network configuration` in your Manifest? – Boken Jun 11 '20 at 21:30
  • @Boken all urls are https. No , I don’t use a additional network config. – Developer2as Jun 11 '20 at 22:15
  • Did you try add failure listener and print message (to the console)? – Boken Jun 11 '20 at 22:16
  • @Boken do you mean this Listener ? https://bumptech.github.io/glide/doc/debugging.html#requestlistener-and-custom-logs – Developer2as Jun 11 '20 at 22:26
  • Yes. Do you have any information here? – Boken Jun 11 '20 at 23:02
  • If I try to log the possible exception on the listener method "onLoadFailed", logcat doesn´t log a error. The network profiler doesn´t fetch large data (like the size of the image resources). I checked my server logs and unfortunately there are no requests from my app. – Developer2as Jun 12 '20 at 07:26
  • Did you try to add `network_security_config` in to Manifest? I explained it there: https://stackoverflow.com/a/60192032/5529263 (it's for Flutter, but you can do only Android steps) – Boken Jun 12 '20 at 20:10
  • No, because a solved my problem today. I added following two methods (.asBitmap() and .placeholder()) to the GlideApp-method call from the topic and it’s works on devices with android 8+ . Now I have to test this solution on devices with android < 8 . – Developer2as Jun 13 '20 at 14:45

0 Answers0