Closed roncbird closed 5 years ago
I was able to figure out the issue. We are using kotlin-dsl gradle, and I was trying to add the glide complier dependency like this annotationProcessor(Libs.com_github_bumptech_glide_compiler), which was causing the problem. I had to add the dependency like this kapt(Libs.com_github_bumptech_glide_compiler). So, instead of using annotationProcessor I had to use kapt.
Glide Version: 4.9.0
Integration libraries: We are using stock networking.
Device/Android Version: I don't think it is device specific, but I've tested it on a Pixel 2 emulator running API 27, on a physical Pixel 3 running API 28, and Samsung Note 8 running API 25
Issue details / Repro steps / Use case background:
I have implemented a custom ModelLoader and DataFetcher following Glides tutorial https://bumptech.github.io/glide/tut/custom-modelloader.html. From what I can tell I have implemented it correctly, but I am still getting the following error:
com.bumptech.glide.Registry$NoModelLoaderAvailableException: Failed to find any ModelLoaders for model: android.graphics.pdf.PdfRenderer$Page@6e667d5
Please see the relevant classes below:
We are displaying PDF pages natively, using Android PdfRenderer to get each page and then render that page into a Bitmap. Each Bitmap is then loaded into an ImageView inside a CardView. Each CardView is displayed in a RecyclerView using Airbnb's Epoxy library. To quickly display large PDFs, we have to use Epoxy's extension function addGlidePreloader() to allow us to preload a set number of pages a head of time to allow for smooth scrolling. Here is the addGlidePreloader implementation:
Here is the RequestManager loadImage() extension function:
Here is the showPage lambda:
When our fragment starts up, it makes a network call to get the PDF, then stores the file in memory, and then Epoxy attempts to use the RequestManger extension function loadImage() to get the pdfPages rendered as a Bitmap, and that is when the logs start reporting the errors.
Hopefully that makes sense. Please let me know if there are any questions, and thanks in advance for any help you can provide.
Stack trace / LogCat: