Skip to content

Glide placeholder() and error() with Resource IDs Not Working in On-Demand Module #5700

Description

@mukeshwondersoft

When using Glide inside an Android Play Feature Delivery (On-Demand) module, placeholder() and error() do not display images when a drawable resource ID is passed directly.

Not Working

Glide.with(context)
    .load(imageUrl)
    .placeholder(R.drawable.placeholder)
    .error(R.drawable.placeholder)
    .into(imageView)

The image loads correctly when the URL is valid, but the placeholder and error drawables are never displayed.

Working Alternative

If the drawable is first converted to a Drawable object using AppCompatResources.getDrawable(), Glide works as expected:

val drawable = AppCompatResources.getDrawable(context, R.drawable.placeholder)

Glide.with(context)
    .load(imageUrl)
    .placeholder(drawable)
    .error(drawable)
    .into(imageView)

Environment

  • Glide: 5.0.7 (With KSP Compiler)
  • Android Gradle Plugin: 9.2.1
  • Play Feature Delivery / On-Demand Module

Expected Behavior

placeholder(R.drawable.xxx) and error(R.drawable.xxx) should work the same way in an on-demand feature module as they do in the base module.

Actual Behavior

Resource IDs passed to placeholder() and error() are ignored or fail to resolve in the on-demand module, while manually resolving the drawable via AppCompatResources.getDrawable() works correctly.

Additional Notes

This issue appears to be specific to Play Feature Delivery (dynamic feature/on-demand) modules. The same code works correctly when placed in the base application module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions