-
Notifications
You must be signed in to change notification settings - Fork 61
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
Crash with Resources$NotFoundException #60
Comments
@Suvorov-Alex Fixed on my version of the lib: https://github.com/B3nedikt/ViewPump In short you can't use ContextWrappers which overwrite getResources() anymore when you overwrite attachBaseContext(...) like in this original version of ViewPump. |
@B3nedikt Can you explain to me why you cannot use the ContextWrappers any longer? Or have a link explaining? I can't seem to find anything about it. |
@Fredcopper Of course you can still use ContextWrappers, but as I have written above not in the way used in this version of ViewpPump. I can´t think of any link that explains the issue well in full, but a second of googling brings up this stackoverflow post which explains it at least in part. For details I can only recommend looking into googles git yourself, code is the best documentation ;) |
@B3nedikt thank you, that stack overflow post is sufficient. |
Hi @B3nedikt I didn't find any such context wrapper in code. Can you please specify the file name? |
This repository uses one here. |
I have this crash in my app too, than i new a webview object in application ,this crash fixed for me. |
when i use viewpump to dynamic load string res,i found when i wrap a context in attachBaseContext,when the page hava webview,long press and use select tag may case crash, this becasue webview will load resource on webview first init,to fix this problem,to fix this problem have two ways:1:init webview before use it. 2:load webview resource by ourself. |
PRs are welcome, disappointed to see a fork that never attempted to contribute improvements back |
@ZacSweers To be clear I did create a PR which tried to contribute improvements back: #60 However this PR did not receive any comment after a whole week, the repository had tons of open issues without any maintainer answering, and even the github release version was not up to date with what is on maven central. So obviously I assumed this original version of this lib is no longer actively maintained, and I created my own version which follows a very different approach. It builds on the appCompat library to intercept view inflation, and only relies on a custom view inflater when absolutely necessary. I found this approach to be much more stable. I understand your disappointment, but it was certainly not my intent to in any way keep my improvements only to myself. You can also just merge them back in if you want, however understand that they follow a very different approach, and have a slightly different interface. It really depends on the future direction you have intended for your version of this library. |
I assume you meant to link this: #57 Didn't see that before, so I apologize for suggesting no effort had been made as I admittedly only checked open PRs. You're right that this library hasn't seen much development as the API is stable and doesn't need much work, but expecting a one week turnaround on a volunteer project in 2020 of all years seems... misguided. I took a look at the PR. 90% of it is unrelated build and refactoring noise, but the rest seems more or less hardcoded for your use case. We may solve it that way, but probably not quite like that. |
Yes, I meant this PR :) I obviously don't expect a one week turnaround of a volunteer project, more like the combination of factors made me think it is likely not worth to try to reach out to contribute. But anyway, I think this is more of a general discussion. I think @dahaidadavid summarizes the issue well, the problem is that a web view needs to load resources dynamically after inflation. Thanks to the way appCompat works since version 1.2, dynamically loading resources will fail when trying to provide a custom I think there are three ways around this:
I think this issue can be solved with anything from adding a bit more documentation to the Readme to changing the entire behavior of the library xD |
I have used both the InflationX and @B3nedikt versions for a long time, especially B3nedikt's version. When I encountered various issues with the InflationX version, it was B3nedikt's version that saved me. It is very stable and reliable, and the source code looks simpler, which I think is a better implementation. Anyway, I very thank InflationX for proposing such a programming method and API, and also very thank @B3nedikt for providing a perhaps better solution in a timely manner. You are both our heroes. |
The most crashes on Samsung, Huawei, Xiaomi, 100% crashes on Android 8 or higher
The text was updated successfully, but these errors were encountered: