glide icon indicating copy to clipboard operation
glide copied to clipboard

Glide ResourceLoader fails to load vector resource

Open newmanw opened this issue 2 years ago • 0 comments

Glide Version: 4.13.2 Device/Android Version: Any/All Issue details / Repro steps / Use case background:

I have a a couple loaders that are used in fallback cases if no previous loader could handle the image. In this case something like this:

class FallbackLoader private constructor(
    private val resourceLoader: ModelLoader<Int, InputStream>
) : ModelLoader<Attachment, InputStream> {

    override fun buildLoadData(model: Attachment, width: Int, height: Int, options: Options): ModelLoader.LoadData<InputStream>? {
        return resourceLoader.buildLoadData(R.drawable.my_icon, width, height, options)
    }

However if that drawable resource is a vector:

<vector android:height="24dp" android:tint="#000000"
    android:viewportHeight="24" android:viewportWidth="24"
    android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
...
...
</vector>

Glide fails to load:

2022-05-20 16:31:49.962 22063-22063/mil.nga.giat.mage.debug W/Glide: Load failed for com.test.app@7f90e0[...] with size [948x550] class com.bumptech.glide.load.engine.GlideException: Failed to load resource Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{AssetInputStream->Object->Drawable}, LOCAL Cause (1 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{AssetInputStream->GifDrawable->Drawable} Cause (2 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{AssetInputStream->Bitmap->BitmapDrawable} Cause (3 of 3): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{AssetInputStream->BitmapDrawable->Drawable}

newmanw avatar May 20 '22 22:05 newmanw