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

Resource not found exception for drawables that show up in preview. #179

Closed
cj1098 opened this issue Oct 4, 2021 · 4 comments
Closed

Resource not found exception for drawables that show up in preview. #179

cj1098 opened this issue Oct 4, 2021 · 4 comments

Comments

@cj1098
Copy link

cj1098 commented Oct 4, 2021

It crashes ShowKase when it tries to get a drawable it can't find from a separate module I assume. Although Android studio preview renders it fine.

@vinaygaba
Copy link
Collaborator

Can you also post the stack trace here and the composable function in question if you can share its implementation

@cj1098
Copy link
Author

cj1098 commented Oct 4, 2021

I unfortunately erased my changes on the branch I was testing the implementation because it seemed it wouldn't work for our use case. I can re-do it and post it tomorrow I think. It's probably because it's trying to access a drawable in a different module.. although our dependency setup allows for that, I'm not sure if ShowKase does

@vinaygaba
Copy link
Collaborator

There's nothing that should stop you from doing it because all Showkase is doing is simply invoking your preview function. It does not know anything about the implementation details of the function itself so it shouldn't matter as long as your preview function isn't private. Hence I'd love to see the stacktrace as that should have more clues.

@cj1098
Copy link
Author

cj1098 commented May 11, 2022

Hey @vinaygaba! Sorry I haven't responded for a while. We decided to hold off on using this until we could figure out the resource issue. I'm still running into the same issue on beta 08 (version that supports multi-module).
The exact error I get is this:

E/ComplexColorCompat: Failed to inflate ComplexColor.
    android.content.res.Resources$NotFoundException: Resource ID #0x0

The implementation of the composable doesn't really matter I don't think. It crashes when it tries to read from the line that tries to access that drawable. The drawable is a vector image btw.
This is the line btw
Icon(painter = painterResource(id = R.drawable.ic_attach), contentDescription = null)
It is in a different module than the main one that has the @ShowkaseRoot class implementation. I'll keep investigating to see if I can find out more info but wanted to let you know in case you knew a solution.
I'd like to move to beta12 but it seems it doesn't recognize other composables outside the main module.

Edit: I think it was something in how we're using our vector images with our attributes. Changed some things around and it seems to work now! :D

@cj1098 cj1098 closed this as completed May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants