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

is not accessible webview error #34

Open
ardagoc opened this issue Mar 4, 2024 · 7 comments
Open

is not accessible webview error #34

ardagoc opened this issue Mar 4, 2024 · 7 comments

Comments

@ardagoc
Copy link

ardagoc commented Mar 4, 2024

We have problems when using a notification sdk. When an inapp message is triggered, the webview can not be inflated and this error is shown.

android.view.InflateException: Binary XML file line #26 in com.pg.xyzapp.test:layout/ins_lay_xcv_sty_4: Binary XML file line #26 in com.pg.xyzapp.test:layout/ins_lay_xcv_sty_4: Error inflating class com.useinsider.insider.InsiderView
Caused by: android.view.InflateException: Binary XML file line #26 in com.pg.xyzapp.test:layout/ins_lay_xcv_sty_4: Error inflating class com.useinsider.insider.InsiderView
Caused by: java.lang.IllegalAccessException: java.lang.Class<com.useinsider.insider.InsiderView> is not accessible from java.lang.Class<androidx.appcompat.app.ViewPumpAppCompatDelegate>
	at java.lang.reflect.Constructor.newInstance0(Native Method)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
	at androidx.appcompat.app.ViewPumpAppCompatDelegate.createCustomWebView(ViewPumpAppCompatDelegate.kt:149)
	at androidx.appcompat.app.ViewPumpAppCompatDelegate.access$createCustomWebView(ViewPumpAppCompatDelegate.kt:30)
	at androidx.appcompat.app.ViewPumpAppCompatDelegate$createView$1.invoke(ViewPumpAppCompatDelegate.kt:86)
	at androidx.appcompat.app.ViewPumpAppCompatDelegate$createView$1.invoke(ViewPumpAppCompatDelegate.kt:56)
	at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:26)
	at dev.b3nedikt.reword.RewordInterceptor.intercept(RewordInterceptor.kt:34)
	at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:37)
	at androidx.appcompat.app.ViewPumpAppCompatDelegate.inflate(ViewPumpAppCompatDelegate.kt:121)
	at androidx.appcompat.app.ViewPumpAppCompatDelegate.createView(ViewPumpAppCompatDelegate.kt:56)
	at androidx.appcompat.app.ViewPumpAppCompatDelegate.onCreateView(ViewPumpAppCompatDelegate.kt:107)
	at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1071)
	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1007)
	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:971)
	at android.view.LayoutInflater.rInflate(LayoutInflater.java:1133)
	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1094)
	at android.view.LayoutInflater.rInflate(LayoutInflater.java:1136)
	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1094)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:692)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:536)
	at com.android.internal.policy.HwPhoneLayoutInflater.inflate(HwPhoneLayoutInflater.java:138)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:483)
	at com.useinsider.insider.n.H(Unknown Source:30)
	at com.useinsider.insider.n.c(Unknown Source:0)
	at com.useinsider.insider.n$a.run(Unknown Source:23)
	at android.os.Handler.handleCallback(Handler.java:900)
	at android.os.Handler.dispatchMessage(Handler.java:103)
	at android.os.Looper.loop(Looper.java:219)
	at android.app.ActivityThread.main(ActivityThread.java:8668)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
@B3nedikt
Copy link
Owner

Can you intialize this InsiderView yourself? If you can a simple workaround would be to add a custom inflater specific for it.

@ardagoc
Copy link
Author

ardagoc commented Mar 23, 2024

InsiderView is a private web view in the external notification sdk. It can be inflated as an inapp message at any time in any activity. It is managed by the sdk, so I can't see a possible way to inflate it by a custom inflator. Is there any way to exclude it from ViewPump or make it accessible by ViewPump?

@B3nedikt
Copy link
Owner

B3nedikt commented Mar 24, 2024

I guess the easiest way would be to just pass in the unwrapped context when you initialize that SDK.

The other options you mentioned would work as well, but would be more difficult to do:

  • Exclude it from ViewPump: ViewPump does not have an API like this yet, but it would be easy to write one. The question here is how the custom inflater of that external SDK works. I mean your crash log clearly shows that ViewPump tried to inflate the view, so for whatever reason, this custom inflater was not correctly installed. Could you clone this repository, and integrate this external SDK in the sample app in a similar way then in your production code, so that it reproduces the crash as close as possible? I know this would take a bit of time from your side, if it is worth kind of depends on how important this issue is for you. This way I could get a feeling for how that external API works, and how a good new API for ViewPump to exclude classes from it could look like.
  • Make it accessible by ViewPump: This should work as well, you can just use reflection to remove the private modifier from that class and inflate it manually in a new ViewPump interceptor. A bit hacky though, especially considering that it I would assume it normally uses a custom inflater for a reason ;)

@B3nedikt
Copy link
Owner

Closed due to inactivity.

@OvoMaS
Copy link

OvoMaS commented Jun 14, 2024

Hello @B3nedikt, would it be possible to reopen the issue? I've forked this repo and updated the sample Kotlin app to reproduce the issue.

https://github.com/OvoMaS/ViewPump/tree/insider_inapp_crash

The sample app does not compile because there are some missing configurations which I can't share publicly (google-services.json, some config keys), but I can send them to you in private.

Thanks for the assistance.

@B3nedikt
Copy link
Owner

Hi @OvoMaS :) Of course that would be possible, you can send me the keys e.g. by mail: [email protected], or through a private repository.

@B3nedikt B3nedikt reopened this Jun 14, 2024
@OvoMaS
Copy link

OvoMaS commented Jun 14, 2024

You should have received an email with all the details.

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

3 participants