Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android.resource Uris that point to another package's resource ID fail to load #42

Closed
audkar opened this issue Aug 17, 2019 · 6 comments · Fixed by #107
Closed

android.resource Uris that point to another package's resource ID fail to load #42

audkar opened this issue Aug 17, 2019 · 6 comments · Fixed by #107
Labels
bug Something isn't working

Comments

@audkar
Copy link

audkar commented Aug 17, 2019

Describe the bug
imageView.load(uri) doesn't load image from android.resource:// uri.

To Reproduce

  1. Apply this patch to coil sample app.
  2. Run sample app
  3. Notice icon image is not loaded.
  4. To check expected result comment out detail.load(uri) and un-comment detail.setImageURI(uri)

Expected behavior
Image loaded from uri

Logs/Screenshots

Current Expected
Screenshot_1566084096 Screenshot_1566083962

Library version
0.6.1

tested on Android 10

@audkar audkar added the bug Something isn't working label Aug 17, 2019
@colinrtwhite
Copy link
Member

Thanks for the report. I'll take a look into this later today.

@colinrtwhite
Copy link
Member

Confirmed. android.resource Uris that point to a vector drawable (or anything that can't be handled by BitmapFactory currently won't load correctly. Have an idea in mind of how to fix this and will make sure the fix makes it into 0.7.0.

As a work around you can pass the resource ID directly to load: .load(R.drawable.image)

@colinrtwhite colinrtwhite changed the title Fails to load image from resource Uri android.resource Uris that point to a vector drawable fail to load Aug 19, 2019
@ediTLJ
Copy link

ediTLJ commented Aug 20, 2019

As a work around you can pass the resource ID directly to load: .load(R.drawable.image)

Does that work for you? I also tried the resource id directly (with several vector drawables) and it doesn't seem to work.

@colinrtwhite
Copy link
Member

Closing this as it's fixed by #75. The fix will soon be released in 0.7.0 or you can depend on the development snapshots if you need it before then.

@audkar
Copy link
Author

audkar commented Sep 9, 2019

@colinrtwhite this still doesn't work if referenced URI is from different package.

I updated initial example patch to reproduce issue

coil version 0.7.0

@colinrtwhite
Copy link
Member

Thanks, I'll take a look into this next week (away on holiday this week).

@colinrtwhite colinrtwhite reopened this Sep 10, 2019
@colinrtwhite colinrtwhite changed the title android.resource Uris that point to a vector drawable fail to load android.resource Uris that point to another package's resource ID fail to load Sep 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants