B3nedikt / restring

Restring is a android library to replace string resources dynamically
Apache License 2.0
317 stars 31 forks source link

Restring library not working for Samsung devices Android 9 webview #141

Open anjali-purohit opened 10 months ago

anjali-purohit commented 10 months ago

Hi @B3nedikt ,

We have observed crashes in Samsung device with Android version 9 for webview. Whenever there is a click on CalendarView / DatePicker / NumberPicker, the app is crashing.

Below are the SDKs used in our app :

// Replace bundled strings dynamically implementation "dev.b3nedikt.restring:restring:5.2.2" // Intercept view inflation implementation "dev.b3nedikt.viewpump:viewpump:4.0.13" // Allows to update the text of views at runtime without recreating the activity implementation "dev.b3nedikt.reword:reword:4.0.4"

Please find below crash log:

android.content.res.Resources$NotFoundException: Unable to find resource ID #0x20c0050
20:04:40.290  W     at android.content.res.ResourcesImpl.getResourceEntryName(ResourcesImpl.java:279)
20:04:40.290  W     at android.content.res.Resources.getResourceEntryName(Resources.java:2002)
20:04:40.290  W     at dev.b3nedikt.restring.internal.ResourcesDelegate.getStringFromRepository(ResourcesDelegate.kt:135)
20:04:40.290  W     at dev.b3nedikt.restring.internal.ResourcesDelegate.getText(ResourcesDelegate.kt:64)
20:04:40.290  W     at dev.b3nedikt.restring.internal.RestringResources.getText(RestringResources.kt:50)
20:04:40.290  W     at android.content.Context.getText(Context.java:565)
20:04:40.290  W     at org.chromium.content.browser.picker.InputDialogContainer.showPickerDialog(InputDialogContainer.java:52)
20:04:40.290  W     at org.chromium.content.browser.picker.InputDialogContainer.showPickerDialog(InputDialogContainer.java:22)
20:04:40.290  W     at org.chromium.content.browser.input.DateTimeChooserAndroid.createDateTimeChooser(DateTimeChooserAndroid.java:12)
20:04:40.290  W     at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
20:04:40.290  W     at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:9)
20:04:40.290  W     at android.os.Handler.dispatchMessage(Handler.java:106)

Is there a workaround to fix this issue ?

Thanks !!

B3nedikt commented 10 months ago

@anjali-purohit This should already have been fixed with an earlier version of ViewPump then the one you are using. Can you post the HTML for which you get the crash?

anjali-purohit commented 10 months ago

Hi @B3nedikt ,

The crash is happening only while clicking on CalendarView / DatePicker / NumberPicker from webview on Android 9 devices. It works fine on other android versions.

After analyzing further, I have noticed that there is a specific condition added to handle Android 9 SDK in ViewPumpAppCompatDelegate class.

             `  // On Android P normally inflated dialog views crash when used in dialogs
                // opened from web views, we therefor replace them with their newer versions
                // from androidx
                if (Build.VERSION.SDK_INT == Build.VERSION_CODES.P) {
                    view = createDialogWidgetView(name, view, attrs)
                }`

And inside createDialogWidgetView method, the CalendarView / DatePicker / NumberPicker is not handled.

  ` return when (name) {
        "com.android.internal.widget.AlertDialogLayout" ->
            AlertDialogLayout(createWrappedContext(), attrs)

        "com.android.internal.widget.DialogTitle" ->
            DialogTitle(createWrappedContext(), attrs)

        "com.android.internal.widget.ButtonBarLayout" ->
            ButtonBarLayout(createWrappedContext(), attrs)

        else -> view
    }`

In the above method, the parameter name will be "com.android.internal.widget.CalendarView" OR "com.android.internal.widget.DatePicker" OR "com.android.internal.widget.NumberPicker"

Could you please help on how to handle these views for Android 9 devices.

Thanks!!

B3nedikt commented 10 months ago

Yes, this code deals with dialogs on android 9, and should fix your issue. Calendars and number pickers work just fine for me on android 9. I mean I could add this three views you mentioned here, and it may fix your issue. However it would be better if I could somehow reproduce your issue on my side, as it would mean I don't need to add code to the project, which I cannot verify to be correct. So if you can reproduce the issue e.g. by cloning this repository and changing the sample app so that it reproduces the crash that would help. If you cannot reproduce the issue outside of your project, I may add it as well, I don't think it will have any negative side effects, but being able to test it would be better of course ;)

anjali-purohit commented 10 months ago

Hi @B3nedikt ,

Thanks for your update. It would be of great help if you could add the mentioned views as well in the repo.

Mostly, the crashes are observed on Samsung devices with Android 9 version specifically. Could you please try to reproduce from your end on samsung devices with android 9 version as well. However, I will also clone the repository and try to reproduce this issue on the sample app.

Thanks !!

B3nedikt commented 10 months ago

I don't have a Samsung with android 9 unfortunately. The fix should work though, even though it is not possible to use versions of the widgets from "androidx.appcompat.widget" as they don't exist. But using the ones from "android.widget" should work fine. I suspect these three internal views have been created by Samsung, therefor they don't exist on any other phones. So replacing them like this should be fine:

            "com.android.internal.widget.CalendarView" ->
                CalendarView(createWrappedContext(), attrs)

            "com.android.internal.widget.DatePicker" ->
                DatePicker(createWrappedContext(), attrs)

            "com.android.internal.widget.NumberPicker" ->
                NumberPicker(createWrappedContext(), attrs)

If you want I would add this code.

anjali-purohit commented 10 months ago

Hi @B3nedikt ,

Thanks for your update. Yes. We have to use these views from "android.widget". android.widget.NumberPicker android.widget.CalendarView android.widget.DatePicker

It would be great if you could add the code in the library itself and publish.

Thanks !!

B3nedikt commented 10 months ago

You're welcome :) I just released the new version as ViewPump 4.0.14, please try it out.

anjali-purohit commented 10 months ago

Hi @B3nedikt ,

I have updated the new version for ViewPump 4.0.14 but still facing crash.

The problem is, in when statement, the name is coming as "DatePicker", "CalendatView", "NumberPicker". Because of that, it is not executing any of the newly added conditions.

May be we need to replace

"com.android.internal.widget.CalendarView" -> CalendarView(createWrappedContext(), attrs)

with

"CalendarView" -> CalendarView(createWrappedContext(), attrs)

Otherwise it always goes to the else condition returning the view as null. Or if you could suggest some better solution, that would also help.

Please find attached screenshot from the library class for the when condition with values.

Screenshot 2024-01-03 at 12 45 15 PM

Thanks!!

B3nedikt commented 10 months ago

Should be safe to do so, as these views should be created for other devices as well. I would add an additional null check though, if the view has already been created by the framework, it should be used. So: name == "CalendarView" && view == null -> CalendarView(createWrappedContext(), attrs)

anjali-purohit commented 10 months ago

Sure @B3nedikt . Let me know once you publish these changes. I will retry from my end.

B3nedikt commented 10 months ago

I just checked, it is also null in the emulator, but creating it manually does not influence anything for other devices. Please try it out on jitpack with this Jitpack Snapshot first, if it works I will create a real release with the fix.

anjali-purohit commented 10 months ago

Hi @B3nedikt ,

Unfortunately we won't be able to use the Jitpack snapshot as it is not compatible to our project. Could you please make the changes in the library itself and publish it.

Also, one question, is it safe to use view == null ? Will it have any impact on other android versions using CalendarView.

Thanks!!

B3nedikt commented 10 months ago

I can, but I would like to first verify that the new changes actually fix your issue, without publishing a new version of the library. After the first try did not work, I became a bit sceptical and I don't want to create another not working release for everyone ;)

The new code does not use view == null, it would be save to do so though. See here for the Changes. It will not have any impact on other android versions, the changes only effect android 9.

If you can't use jitpack, would sonatype snapshots work for you?

anjali-purohit commented 9 months ago

Hi @B3nedikt , Unfortunately in our project we only use the dependencies for third party library integration. I won't be able to test it through other sources. I tried to create a custom class for ViewPumpAppCompatDelegate in my project but it is using few internal classes so I couldn't do that as well. Could you please publish the changes in the library itself so that its feasible for us to integrate the library. Thanks!!

B3nedikt commented 9 months ago

I think I have a solution ;) I will upload a new version with the version format like "4.0.15-alpha1" later this week. This way you won't have to use a snapshot repository, and I can upload new versions with users hopefully not updating to a potentially broken version xD That aside, might I ask why you can't use snapshots? Is the project just badly set up, or can't you access the repository due to some VPN or whatever? Just out of interest ;)

anjali-purohit commented 9 months ago

Hi @B3nedikt ,

The project architecture is properly setup. Its just that We need to whitelist the repositories that we want to access. Thats why we use the actual library version in our application for third party dependencies which are whitelisted on our end.

But we can try both ways for testing. You can share the snapshot version, I'll check if it fetches the data from the repository unlike the Jitpack as we faced issue in fetching the jitpack repo. OR publish new build as "4.0.15-alpha1" . Anything is fine.

Thanks!!

B3nedikt commented 9 months ago

@anjali-purohit Okay, I created a new ViewPump version "4.0.15-alpha01".

anjali-purohit commented 9 months ago

Hi @B3nedikt , I have tried the new version "4.0.15-alpha01" but still the app is crashing as soon as I am clicking on calendar view in samsung device with android 9.

Could you please help to resolve this issue. Many users are affected with this crash.

Please find below crash logs.

/System.err: android.view.InflateException: Binary XML file line #18: Binary XML file line #75: Binary XML file line #75: Error inflating class CalendarView W/System.err: Caused by: android.view.InflateException: Binary XML file line #75: Binary XML file line #75: Error inflating class CalendarView W/System.err: Caused by: android.view.InflateException: Binary XML file line #75: Error inflating class CalendarView I/System.out: (HTTPLog)-Static: isSBSettingEnabled false W/System.err: Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 15: TypedValue{t=0x2/d=0x101042a a=1} W/System.err: at android.content.res.TypedArray.getColorStateList(TypedArray.java:546) W/System.err: at android.widget.DayPickerView.<init>(DayPickerView.java:102) I/System.out: (HTTPLog)-Static: isSBSettingEnabled false W/System.err: at android.widget.CalendarViewMaterialDelegate.<init>(CalendarViewMaterialDelegate.java:35) W/System.err: at android.widget.CalendarView.<init>(CalendarView.java:121) W/System.err: at android.widget.CalendarView.<init>(CalendarView.java:103) W/System.err: at android.widget.CalendarView.<init>(CalendarView.java:98) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate.createDialogWidgetView(ViewPumpAppCompatDelegate.kt:194) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate.access$createDialogWidgetView(ViewPumpAppCompatDelegate.kt:38) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate$createView$1.invoke(ViewPumpAppCompatDelegate.kt:102) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate$createView$1.invoke(ViewPumpAppCompatDelegate.kt:65) W/System.err: at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:26) W/System.err: at dev.b3nedikt.reword.RewordInterceptor.intercept(RewordInterceptor.kt:34) W/System.err: at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:37) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate.inflate(ViewPumpAppCompatDelegate.kt:137) I/System.out: (HTTPLog)-Static: isSBSettingEnabled false W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate.createView(ViewPumpAppCompatDelegate.kt:65) W/System.err: at androidx.appcompat.app.AppCompatDelegateWrapper.createView(AppCompatDelegateWrapper.kt:156) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate.access$createView$s1741359083(ViewPumpAppCompatDelegate.kt:38) I/System.out: (HTTPLog)-Static: isSBSettingEnabled false W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate$createView$1.invoke(ViewPumpAppCompatDelegate.kt:79) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate$createView$1.invoke(ViewPumpAppCompatDelegate.kt:65) W/System.err: at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:26) W/System.err: at dev.b3nedikt.reword.RewordInterceptor.intercept(RewordInterceptor.kt:34) W/System.err: at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:37) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate.inflate(ViewPumpAppCompatDelegate.kt:137) I/System.out: (HTTPLog)-Static: isSBSettingEnabled false I/System.out: (HTTPLog)-Static: isSBSettingEnabled false W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate.createView(ViewPumpAppCompatDelegate.kt:65) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate.onCreateView(ViewPumpAppCompatDelegate.kt:123) W/System.err: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772) W/System.err: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) W/System.err: at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) W/System.err: at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) W/System.err: at android.view.LayoutInflater.inflate(LayoutInflater.java:515) W/System.err: at android.view.LayoutInflater.inflate(LayoutInflater.java:423) W/System.err: at android.widget.DatePickerSpinnerDelegate.<init>(DatePickerSpinnerDelegate.java:118) W/System.err: at android.widget.DatePicker.createSpinnerUIDelegate(DatePicker.java:198) W/System.err: at android.widget.DatePicker.<init>(DatePicker.java:180) W/System.err: at android.widget.DatePicker.<init>(DatePicker.java:148) W/System.err: at android.widget.DatePicker.<init>(DatePicker.java:144) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate.createDialogWidgetView(ViewPumpAppCompatDelegate.kt:197) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate.access$createDialogWidgetView(ViewPumpAppCompatDelegate.kt:38) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate$createView$1.invoke(ViewPumpAppCompatDelegate.kt:102) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate$createView$1.invoke(ViewPumpAppCompatDelegate.kt:65) W/System.err: at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:26) W/System.err: at dev.b3nedikt.reword.RewordInterceptor.intercept(RewordInterceptor.kt:34) W/System.err: at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:37) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate.inflate(ViewPumpAppCompatDelegate.kt:137) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate.createView(ViewPumpAppCompatDelegate.kt:65) W/System.err: at androidx.appcompat.app.AppCompatDelegateWrapper.createView(AppCompatDelegateWrapper.kt:156) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate.access$createView$s1741359083(ViewPumpAppCompatDelegate.kt:38) I/System.out: (HTTPLog)-Static: isSBSettingEnabled false W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate$createView$1.invoke(ViewPumpAppCompatDelegate.kt:79) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate$createView$1.invoke(ViewPumpAppCompatDelegate.kt:65) W/System.err: at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:26) I/System.out: (HTTPLog)-Static: isSBSettingEnabled false W/System.err: at dev.b3nedikt.reword.RewordInterceptor.intercept(RewordInterceptor.kt:34) W/System.err: at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:37) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate.inflate(ViewPumpAppCompatDelegate.kt:137) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate.createView(ViewPumpAppCompatDelegate.kt:65) W/System.err: at androidx.appcompat.app.ViewPumpAppCompatDelegate.onCreateView(ViewPumpAppCompatDelegate.kt:123) W/System.err: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772) W/System.err: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) W/System.err: at android.view.LayoutInflater.inflate(LayoutInflater.java:492) W/System.err: at android.view.LayoutInflater.inflate(LayoutInflater.java:423) W/System.err: at android.view.LayoutInflater.inflate(LayoutInflater.java:374) W/System.err: at android.app.DatePickerDialog.<init>(DatePickerDialog.java:119) I/SKBD: and isTosAccept false W/System.err: at android.app.DatePickerDialog.<init>(DatePickerDialog.java:90) W/System.err: at Ow0.<init>(chromium-Monochrome.aab-stable-609921021:1) W/System.err: at MO1.d(chromium-Monochrome.aab-stable-609921021:37) W/System.err: at MO1.c(chromium-Monochrome.aab-stable-609921021:127) W/System.err: at org.chromium.content.browser.input.DateTimeChooserAndroid.createDateTimeChooser(chromium-Monochrome.aab-stable-609921021:48) W/System.err: at android.os.MessageQueue.nativePollOnce(Native Method) W/System.err: at android.os.MessageQueue.next(MessageQueue.java:326) W/System.err: at android.os.Looper.loop(Looper.java:181) W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7073) W/System.err: at java.lang.reflect.Method.invoke(Native Method) W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964) I/system_server: libdebuggerd_client: done dumping process 16669

anjali-purohit commented 9 months ago

Hi @B3nedikt , Did you get a chance to check on this issue ? Any update on this ?

B3nedikt commented 9 months ago

Seems like there are still issues with loading all resources. No update at the moment, I would say the next step would be to try using the unwrapped context when inflating. I will create a new alpha version which does this later.

anjali-purohit commented 9 months ago

Hi @B3nedikt ,

Did you get any chance to check the issue. Customers are facing crash for Samsung Android 9 devices. We are blocked right now. Need your support to fix this issue.

Thanks!!

B3nedikt commented 9 months ago

I think I will upload a version of ViewPump tomorrow where you can try different stuff out in the sample app. This should speed things up a bit ;)

B3nedikt commented 9 months ago

Hi :) I created a PR, with a web view in the sample app that uses different elements which show native dialogs like a date picker etc. here. Please try it out on your Samsung device, if you can find a fix.

anjali-purohit commented 9 months ago

Hi @B3nedikt ,

I have checked out your branch feature/espresso and tried the new changes, it is still crashing when I am clicking on the datepicker in Samsung Android 9 device. Although NumberPicker works fine.

Please find attached logs for the same.

View class androidx.appcompat.widget.AppCompatImageView is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant). dev.b3nedikt.viewpump.example E [ERROR:jni_android.cc(319)] Crashing due to uncaught Java exception dev.b3nedikt.viewpump.example E [ERROR:jni_android.cc(358)] Native stack trace:

00 pc 0x0000000002d6026b /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)

                                    #01 pc 0x00000000021dd3cb /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #02 pc 0x00000000021dcfd3 /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #03 pc 0x0000000003f4996b /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #04 pc 0x0000000003f21f3b /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #05 pc 0x0000000003a62147 /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #06 pc 0x00000000021f47ff /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #07 pc 0x00000000021f410f /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #08 pc 0x00000000021f43d7 /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #09 pc 0x00000000022ad7c3 /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #10 pc 0x00000000022ad3e3 /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #11 pc 0x00000000021f410f /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #12 pc 0x00000000021f36af /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #13 pc 0x00000000021f2aff /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #14 pc 0x00000000021f29bf /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #15 pc 0x0000000001d5bc4b /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #16 pc 0x00000000021f2823 /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #17 pc 0x00000000021a3553 /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #18 pc 0x000000000219fe5b /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #19 pc 0x0000000002c18eff /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #20 pc 0x0000000002c18eb3 /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #21 pc 0x0000000000015073 /system/lib64/libutils.so
                                    #22 pc 0x0000000000014c93 /system/lib64/libutils.so
                                    #23 pc 0x00000000000fb5f7 /system/lib64/libandroid_runtime.so

dev.b3nedikt.viewpump.example E Handling uncaught Java exception android.view.InflateException: Binary XML file line #26: Binary XML file line #44: Error inflating class com.android.internal.widget.DialogTitle Caused by: android.view.InflateException: Binary XML file line #44: Error inflating class com.android.internal.widget.DialogTitle Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 6: TypedValue{t=0x2/d=0x101009b a=1} at android.content.res.TypedArray.getColorStateList(TypedArray.java:546) at android.widget.TextView.readTextAppearance(TextView.java:3905) at android.widget.TextView.(TextView.java:1240) at android.widget.TextView.(TextView.java:1129) at androidx.appcompat.widget.AppCompatTextView.(AppCompatTextView.java:113) at androidx.appcompat.widget.AppCompatTextView.(AppCompatTextView.java:108) at androidx.appcompat.widget.DialogTitle.(DialogTitle.java:46) at androidx.appcompat.app.ViewPumpAppCompatDelegate.createDialogWidgetView(ViewPumpAppCompatDelegate.kt:186) at androidx.appcompat.app.ViewPumpAppCompatDelegate.access$createDialogWidgetView(ViewPumpAppCompatDelegate.kt:38) at androidx.appcompat.app.ViewPumpAppCompatDelegate$createView$1.invoke(ViewPumpAppCompatDelegate.kt:102) at androidx.appcompat.app.ViewPumpAppCompatDelegate$createView$1.invoke(ViewPumpAppCompatDelegate.kt:65) at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:26) at dev.b3nedikt.viewpump.sample.CustomTextViewInterceptor.intercept(CustomTextViewInterceptor.kt:31) at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:37) at dev.b3nedikt.viewpump.sample.TextUpdatingInterceptor.intercept(TextUpdatingInterceptor.kt:15) at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:37) at androidx.appcompat.app.ViewPumpAppCompatDelegate.inflate(ViewPumpAppCompatDelegate.kt:137) at androidx.appcompat.app.ViewPumpAppCompatDelegate.createView(ViewPumpAppCompatDelegate.kt:65) at androidx.appcompat.app.ViewPumpAppCompatDelegate.onCreateView(ViewPumpAppCompatDelegate.kt:123) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.rInflate(LayoutInflater.java:866) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.parseInclude(LayoutInflater.java:995) at android.view.LayoutInflater.rInflate(LayoutInflater.java:859) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:469) at com.android.internal.app.AlertController.installContent(AlertController.java:281) at android.app.AlertDialog.onCreate(AlertDialog.java:440) at android.app.Dialog.dispatchOnCreate(Dialog.java:550) at android.app.Dialog.show(Dialog.java:391) at SQ1.d(chromium-Monochrome.aab-stable-616714321:321) at SQ1.c(chromium-Monochrome.aab-stable-616714321:125) at org.chromium.content.browser.input.DateTimeChooserAndroid.createDateTimeChooser(chromium-Monochrome.aab-stable-616714321:48) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:326) at android.os.Looper.loop(Looper.java:181) at android.app.ActivityThread.main(ActivityThread.java:7073) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964) com.sec.android.inputmethod I and isTosAccept false dev.b3nedikt.viewpump.example E FATAL EXCEPTION: main Process: dev.b3nedikt.viewpump.example, PID: 8541 org.chromium.base.JniAndroid$UncaughtExceptionException: Native stack trace:

00 pc 0x0000000002d6026b /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)

                                    #01 pc 0x00000000021dd3cb /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #02 pc 0x00000000021dcfd3 /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #03 pc 0x0000000003f4996b /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #04 pc 0x0000000003f21f3b /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #05 pc 0x0000000003a62147 /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #06 pc 0x00000000021f47ff /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #07 pc 0x00000000021f410f /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #08 pc 0x00000000021f43d7 /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #09 pc 0x00000000022ad7c3 /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #10 pc 0x00000000022ad3e3 /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #11 pc 0x00000000021f410f /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #12 pc 0x00000000021f36af /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #13 pc 0x00000000021f2aff /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #14 pc 0x00000000021f29bf /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #15 pc 0x0000000001d5bc4b /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #16 pc 0x00000000021f2823 /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #17 pc 0x00000000021a3553 /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #18 pc 0x000000000219fe5b /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #19 pc 0x0000000002c18eff /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #20 pc 0x0000000002c18eb3 /data/app/com.android.chrome-Xhj9RofBgZwkEkzntuXpKQ==/base.apk (offset 0xd68000)
                                    #21 pc 0x0000000000015073 /system/lib64/libutils.so
                                    #22 pc 0x0000000000014c93 /system/lib64/libutils.so
                                    #23 pc 0x00000000000fb5f7 /system/lib64/libandroid_runtime.so
                                    at org.chromium.base.JniAndroid.handleException(chromium-Monochrome.aab-stable-616714321:11)
                                        at android.os.MessageQueue.nativePollOnce(Native Method)
                                        at android.os.MessageQueue.next(MessageQueue.java:326)
                                        at android.os.Looper.loop(Looper.java:181)
                                        at android.app.ActivityThread.main(ActivityThread.java:7073)
                                        at java.lang.reflect.Method.invoke(Native Method)
                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
                                    Caused by: android.view.InflateException: Binary XML file line #26: Binary XML file line #44: Error inflating class com.android.internal.widget.DialogTitle
                                    Caused by: android.view.InflateException: Binary XML file line #44: Error inflating class com.android.internal.widget.DialogTitle
                                    Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 6: TypedValue{t=0x2/d=0x101009b a=1}
                                        at android.content.res.TypedArray.getColorStateList(TypedArray.java:546)
                                        at android.widget.TextView.readTextAppearance(TextView.java:3905)
                                        at android.widget.TextView.<init>(TextView.java:1240)
                                        at android.widget.TextView.<init>(TextView.java:1129)
                                        at androidx.appcompat.widget.AppCompatTextView.<init>(AppCompatTextView.java:113)
                                        at androidx.appcompat.widget.AppCompatTextView.<init>(AppCompatTextView.java:108)
                                        at androidx.appcompat.widget.DialogTitle.<init>(DialogTitle.java:46)

dev.b3nedikt.viewpump.example E at androidx.appcompat.app.ViewPumpAppCompatDelegate.createDialogWidgetView(ViewPumpAppCompatDelegate.kt:186) at androidx.appcompat.app.ViewPumpAppCompatDelegate.access$createDialogWidgetView(ViewPumpAppCompatDelegate.kt:38) at androidx.appcompat.app.ViewPumpAppCompatDelegate$createView$1.invoke(ViewPumpAppCompatDelegate.kt:102) at androidx.appcompat.app.ViewPumpAppCompatDelegate$createView$1.invoke(ViewPumpAppCompatDelegate.kt:65) at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:26) at dev.b3nedikt.viewpump.sample.CustomTextViewInterceptor.intercept(CustomTextViewInterceptor.kt:31) at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:37) at dev.b3nedikt.viewpump.sample.TextUpdatingInterceptor.intercept(TextUpdatingInterceptor.kt:15) at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:37) at androidx.appcompat.app.ViewPumpAppCompatDelegate.inflate(ViewPumpAppCompatDelegate.kt:137) at androidx.appcompat.app.ViewPumpAppCompatDelegate.createView(ViewPumpAppCompatDelegate.kt:65) at androidx.appcompat.app.ViewPumpAppCompatDelegate.onCreateView(ViewPumpAppCompatDelegate.kt:123) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.rInflate(LayoutInflater.java:866) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.parseInclude(LayoutInflater.java:995) at android.view.LayoutInflater.rInflate(LayoutInflater.java:859) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:469) at com.android.internal.app.AlertController.installContent(AlertController.java:281) at android.app.AlertDialog.onCreate(AlertDialog.java:440) at android.app.Dialog.dispatchOnCreate(Dialog.java:550) at android.app.Dialog.show(Dialog.java:391) at SQ1.d(chromium-Monochrome.aab-stable-616714321:321) at SQ1.c(chromium-Monochrome.aab-stable-616714321:125) at org.chromium.content.browser.input.DateTimeChooserAndroid.createDateTimeChooser(chromium-Monochrome.aab-stable-616714321:48) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:326) at android.os.Looper.loop(Looper.java:181) at android.app.ActivityThread.main(ActivityThread.java:7073) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

anjali-purohit commented 8 months ago

Hi @B3nedikt , Any update on this issue ? Did you get any workaround for this ? We are still experiencing crashes on Android 9 devices.

B3nedikt commented 8 months ago

I don't have a fix yet, but I just pushed another change to the PR I linked above, can you try it out?

ebayraktar commented 8 months ago

@B3nedikt Hi 👋 , I've been waiting for the solution for this issue but I see @anjali-purohit busy.

I ran my tests and I could reproduce the issue on Android 8.1. I'm not sure this is the same issue but I hope it will help.

You can reach related videos and logs. A simple explanation is if I click the datePicker button the app crashes, but first I click the back button then I reopen the app and click the datePicker button it works as expected.

Log Espresso Test Crash

B3nedikt commented 7 months ago

@ebayraktar So you can only reproduce it on old Samsung devices as well? I don't own one myself, only OnePlus & Xiaomi, so I can't test my fix and need to wait for your input ;)

anjali-purohit commented 7 months ago

Hi @B3nedikt , @ebayraktar ,

Apologies for the late reply. Actually there is no progress for this issue.

I have checked out your branch and pulled the latest changes in the PR... but still the app crashes on samsung android 9 devices while selecting the DatePicker.

Also, @B3nedikt I have one doubt.... is it happening because the app is having multilanguage support ? Will it be facing issue while getting the correct context resource while clicking on the datepicker?

Thanks!!

B3nedikt commented 7 months ago

@anjali-purohit No, it is definitely connected to Samsung devices, or at least the version of the web view apk the device uses. I don't know about the exact reason though, I am just guessing as well. I just pushed another version, please try it out ;)

anjali-purohit commented 7 months ago

Hi @B3nedikt ,

I have taken latest pull from your branch. I could see that you have removed the Android version check... but unfortunately on clicking the date picker the app is still crashing....

I have added the error logs below.

stageIndex is 0, get default sink buf com.sec.android.app.launcher E No package ID ff found for ID 0xffffffff. com.sec.android.app.launcher E Could not find icon drawable from resource android.content.res.Resources$NotFoundException: Resource ID #0xffffffff at android.content.res.ResourcesImpl.getValueForDensity(ResourcesImpl.java:237) at android.content.res.Resources.getDrawableForDensity(Resources.java:902) at android.content.res.Resources.getDrawable(Resources.java:842) at com.android.systemui.shared.recents.model.IconLoader.createNewIconForTask(IconLoader.java:118) at com.android.systemui.shared.recents.model.IconLoader.getAndInvalidateIfModified(IconLoader.java:94) at com.android.systemui.shared.recents.model.RecentsTaskLoader.getAndUpdateActivityIcon(RecentsTaskLoader.java:340) at com.android.systemui.shared.recents.model.RecentsTaskLoadPlan.executePlan(RecentsTaskLoadPlan.java:258) at com.android.systemui.shared.recents.model.RecentsTaskLoader.loadTasks(RecentsTaskLoader.java:185) at com.android.launcher3.quickstep.RecentsModel.onTaskStackChangedBackground(RecentsModel.java:269) at com.android.systemui.shared.system.TaskStackChangeListeners.onTaskStackChanged(TaskStackChangeListeners.java:82) at android.app.ITaskStackListener$Stub.onTransact(ITaskStackListener.java:50) at android.os.Binder.execTransact(Binder.java:739)

Caused by: android.view.InflateException: Binary XML file line #35: Error inflating class TextView Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 6: TypedValue{t=0x2/d=0x101009b a=1} at android.content.res.TypedArray.getColorStateList(TypedArray.java:546) at android.widget.TextView.readTextAppearance(TextView.java:3905) at android.widget.TextView.<init>(TextView.java:1240) at android.widget.TextView.<init>(TextView.java:1129) at androidx.appcompat.widget.AppCompatTextView.<init>(AppCompatTextView.java:113) at androidx.appcompat.widget.AppCompatTextView.<init>(AppCompatTextView.java:108) at dev.b3nedikt.viewpump.sample.CustomTextView.<init>(CustomTextView.kt:9) at dev.b3nedikt.viewpump.sample.CustomTextViewInterceptor.inflateView(CustomTextViewInterceptor.kt:37) at dev.b3nedikt.viewpump.sample.CustomTextViewInterceptor.intercept(CustomTextViewInterceptor.kt:18) at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:37) at dev.b3nedikt.viewpump.sample.TextUpdatingInterceptor.intercept(TextUpdatingInterceptor.kt:15) at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:37) at androidx.appcompat.app.ViewPumpAppCompatDelegate.inflate(ViewPumpAppCompatDelegate.kt:135) at androidx.appcompat.app.ViewPumpAppCompatDelegate.createView(ViewPumpAppCompatDelegate.kt:68) at androidx.appcompat.app.ViewPumpAppCompatDelegate.onCreateView(ViewPumpAppCompatDelegate.kt:121) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.rInflate(LayoutInflater.java:866) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.parseInclude(LayoutInflater.java:995) at android.view.LayoutInflater.rInflate(LayoutInflater.java:859) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.widget.DatePickerCalendarDelegate.<init>(DatePickerCalendarDelegate.java:113) at android.widget.DatePicker.createCalendarUIDelegate(DatePicker.java:203) at android.widget.DatePicker.<init>(DatePicker.java:176) at android.widget.DatePicker.<init>(DatePicker.java:148) at android.widget.DatePicker.<init>(DatePicker.java:144) at androidx.appcompat.app.ViewPumpAppCompatDelegate.createDialogWidgetView(ViewPumpAppCompatDelegate.kt:198) at androidx.appcompat.app.ViewPumpAppCompatDelegate.access$createDialogWidgetView(ViewPumpAppCompatDelegate.kt:39) at androidx.appcompat.app.ViewPumpAppCompatDelegate$createView$1.invoke(ViewPumpAppCompatDelegate.kt:101) at androidx.appcompat.app.ViewPumpAppCompatDelegate$createView$1.invoke(ViewPumpAppCompatDelegate.kt:68) at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:26) at dev.b3nedikt.viewpump.sample.CustomTextViewInterceptor.intercept(CustomTextViewInterceptor.kt:31) at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:37) at dev.b3nedikt.viewpump.sample.TextUpdatingInterceptor.intercept(TextUpdatingInterceptor.kt:15) at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:37) at androidx.appcompat.app.ViewPumpAppCompatDelegate.inflate(ViewPumpAppCompatDelegate.kt:135) at androidx.appcompat.app.ViewPumpAppCompatDelegate.createView(ViewPumpAppCompatDelegate.kt:68) dev.b3nedikt.viewpump.example E at androidx.appcompat.app.ViewPumpAppCompatDelegate.onCreateView(ViewPumpAppCompatDelegate.kt:121) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at android.app.DatePickerDialog.<init>(DatePickerDialog.java:119) at android.app.DatePickerDialog.<init>(DatePickerDialog.java:90) at Ix0.<init>(chromium-Monochrome.aab-stable-626111921:1) at qP1.d(chromium-Monochrome.aab-stable-626111921:37) at qP1.c(chromium-Monochrome.aab-stable-626111921:125) at org.chromium.content.browser.input.DateTimeChooserAndroid.createDateTimeChooser(chromium-Monochrome.aab-stable-626111921:48) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:326) at android.os.Looper.loop(Looper.java:181) at android.app.ActivityThread.main(ActivityThread.java:7073) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

B3nedikt commented 7 months ago

@anjali-purohit Yeah, I removed the android version check, as @ebayraktar wrote that it also occurs on android 8.1. As the new solution would be independent of the android version anyway, I decided to remove the version check for now.

I just pushed the next try, it seems the custom inflater used in the demo app is at fault now, so I changed the logic to just catch any inflation error for now, so everything gets done by the fallback inflator. I just pushed this, please try it out again ;)

It will be interesting, if this kind of remote debugging will lead to a fix at some point, but I think we are getting closer.

anjali-purohit commented 7 months ago

Hi @B3nedikt , Unfortunately the new changes also not working... Still getting crash.

android.view.InflateException: Binary XML file line #18: Binary XML file line #18: Error inflating class android.widget.DatePicker Caused by: android.view.InflateException: Binary XML file line #18: Error inflating class android.widget.DatePicker Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at android.view.LayoutInflater.createView(LayoutInflater.java:647) at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at android.app.DatePickerDialog.<init>(DatePickerDialog.java:119) at android.app.DatePickerDialog.<init>(DatePickerDialog.java:90) at Ru0.<init>(chromium-Monochrome.aab-stable-631204021:1) at UI1.d(chromium-Monochrome.aab-stable-631204021:37) at UI1.c(chromium-Monochrome.aab-stable-631204021:125) at org.chromium.content.browser.input.DateTimeChooserAndroid.createDateTimeChooser(chromium-Monochrome.aab-stable-631204021:48) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:326) at android.os.Looper.loop(Looper.java:181) at android.app.ActivityThread.main(ActivityThread.java:7073) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964) Caused by: android.view.InflateException: Binary XML file line #23: Binary XML file line #35: Error inflating class TextView Caused by: android.view.InflateException: Binary XML file line #35: Error inflating class TextView Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 6: TypedValue{t=0x2/d=0x101009b a=1} at android.content.res.TypedArray.getColorStateList(TypedArray.java:546) at android.widget.TextView.readTextAppearance(TextView.java:3905) at android.widget.TextView.<init>(TextView.java:1240) at android.widget.TextView.<init>(TextView.java:1129) at androidx.appcompat.widget.AppCompatTextView.<init>(AppCompatTextView.java:113) at androidx.appcompat.widget.AppCompatTextView.<init>(AppCompatTextView.java:108) at dev.b3nedikt.viewpump.sample.CustomTextView.<init>(CustomTextView.kt:9) at dev.b3nedikt.viewpump.sample.CustomTextViewInterceptor.inflateView(CustomTextViewInterceptor.kt:37) at dev.b3nedikt.viewpump.sample.CustomTextViewInterceptor.intercept(CustomTextViewInterceptor.kt:18) at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:37) at dev.b3nedikt.viewpump.sample.TextUpdatingInterceptor.intercept(TextUpdatingInterceptor.kt:15) at dev.b3nedikt.viewpump.internal.InterceptorChain.proceed(InterceptorChain.kt:37) at androidx.appcompat.app.ViewPumpAppCompatDelegate.inflate(ViewPumpAppCompatDelegate.kt:135) at androidx.appcompat.app.ViewPumpAppCompatDelegate.createView(ViewPumpAppCompatDelegate.kt:68) at androidx.appcompat.app.ViewPumpAppCompatDelegate.onCreateView(ViewPumpAppCompatDelegate.kt:121) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:772) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.rInflate(LayoutInflater.java:866) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.parseInclude(LayoutInflater.java:995) dev.b3nedikt.viewpump.example E at android.view.LayoutInflater.rInflate(LayoutInflater.java:859) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.widget.DatePickerCalendarDelegate.<init>(DatePickerCalendarDelegate.java:113) at android.widget.DatePicker.createCalendarUIDelegate(DatePicker.java:203) at android.widget.DatePicker.<init>(DatePicker.java:176) at android.widget.DatePicker.<init>(DatePicker.java:148) at android.widget.DatePicker.<init>(DatePicker.java:144) at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at android.view.LayoutInflater.createView(LayoutInflater.java:647) at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at android.app.DatePickerDialog.<init>(DatePickerDialog.java:119) at android.app.DatePickerDialog.<init>(DatePickerDialog.java:90) at Ru0.<init>(chromium-Monochrome.aab-stable-631204021:1) at UI1.d(chromium-Monochrome.aab-stable-631204021:37) at UI1.c(chromium-Monochrome.aab-stable-631204021:125) at org.chromium.content.browser.input.DateTimeChooserAndroid.createDateTimeChooser(chromium-Monochrome.aab-stable-631204021:48) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:326) at android.os.Looper.loop(Looper.java:181) at android.app.ActivityThread.main(ActivityThread.java:7073) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

anjali-purohit commented 5 months ago

Hi @B3nedikt ,

Have you got any update or solution for this crash issue ?

Also, could you please provide me access to any branch of the restring module as well... I will also try end to end flow of the viewpump library implementation.

Thanks!!

B3nedikt commented 5 months ago

Hi @anjali-purohit,

I just pushed another try that came to my mind, please try it out. I still have another idea, but let's see first what the current changes bring ;)

I could of course also import the restring project in the sample project we are using. But you could also add it or any other sample code as well yourself? I don't really understand what you mean here.

anjali-purohit commented 5 months ago

Actually, we are using wrapContext method from Restring library in the ViewPumpAppCompatDelegate, so I wanted to check if we are getting the proper restring context in below code. That's why asked if we could import the restring module as well.

private val appCompatDelegate: AppCompatDelegate by lazy { ViewPumpAppCompatDelegate( baseDelegate = super.getDelegate(), baseContext = this, wrapContext = Restring::wrapContext ) }

But I will try your latest change first and will update you on the result.

Thanks!!

Vamsiraj13 commented 5 months ago

I am getting a similar kind of crash

ResourcesDelegate.getStringFromRepository android.content.res.Resources$NotFoundException - Unable to find resource ID #

Fatal Exception: org.chromium.base.JniAndroid$UncaughtExceptionException
Native stack trace: #00 pc 0x0000000003223e17 /data/app/com.android.chrome-ptpqJHwuZHFJ4lAjjp0Xow==/base.apk (offset 0xd68000) #01 pc 0x000000000257f79f /data/app/com.android.chrome-ptpqJHwuZHFJ4lAjjp0Xow==/base.apk (offset 0xd68000) #02 pc 0x000000000385ff2f /data/app/com.android.chrome-ptpqJHwuZHFJ4lAjjp0Xow==/base.apk (offset 0xd68000) #03 pc 0x00000000031f5317 /data/app/com.android.chrome-ptpqJHwuZHFJ4lAjjp0Xow==/base.apk (offset 0xd68000) #04 pc 0x00000000031f526b /data/app/com.android.chrome-ptpqJHwuZHFJ4lAjjp0Xow==/base.apk (offset 0xd68000) #05 pc 0x000000000258a4df /data/app/com.android.chrome-ptpqJHwuZHFJ4lAjjp0Xow==/base.apk (offset 0xd68000) #06 pc 0x0000000002586f23 /data/app/com.android.chrome-ptpqJHwuZHFJ4lAjjp0Xow==/base.apk (offset 0xd68000) #07 pc 0x0000000004e06313 /data/app/com.android.chrome-ptpqJHwuZHFJ4lAjjp0Xow==/base.apk (offset 0xd68000) #08 pc 0x0000000004e062c7 /data/app/com.android.chrome-ptpqJHwuZHFJ4lAjjp0Xow==/base.apk (offset 0xd68000) #09 pc 0x000000000318d4d7 /data/app/com.android.chrome-ptpqJHwuZHFJ4lAjjp0Xow==/base.apk (offset 0xd68000) #10 pc 0x00000000000144ff /system/lib64/libutils.so #11 pc 0x0000000000014117 /system/lib64/libutils.so #12 pc 0x00000000000f04d7 /system/lib64/libandroid_runtime.so
org.chromium.base.JniAndroid.handleException (chromium-Monochrome.aab-stable-636711321:21)

com.android.internal.os.ZygoteInit.main (ZygoteInit.java:962)
Caused by android.content.res.Resources$NotFoundException
Unable to find resource ID #0x214020d
android.content.res.ResourcesImpl.getResourceEntryName (ResourcesImpl.java:341)

android.content.res.Resources.getResourceEntryName (Resources.java:2048)
dev.b3nedikt.restring.internal.ResourcesDelegate.getStringFromRepository (ResourcesDelegate.kt:135)
dev.b3nedikt.restring.internal.ResourcesDelegate.getString (ResourcesDelegate.kt:49)
dev.b3nedikt.restring.internal.RestringResources.getString (RestringResources.kt:42)
android.content.Context.getString (Context.java:585)
YD3.b (chromium-Monochrome.aab-stable-636711321:154)
org.chromium.content.browser.selection.SelectionPopupControllerImpl.A (chromium-Monochrome.aab-stable-636711321:123)
org.chromium.content.browser.selection.SelectionPopupControllerImpl.L (chromium-Monochrome.aab-stable-636711321:29)
Xw.onPrepareActionMode (chromium-Monochrome.aab-stable-636711321:3)
com.android.internal.policy.DecorView$ActionModeCallback2Wrapper.onPrepareActionMode (DecorView.java:2773)

android.view.View.startActionMode (View.java:6923)
org.chromium.content.browser.selection.SelectionPopupControllerImpl.P (chromium-Monochrome.aab-stable-636711321:91)
org.chromium.content.browser.selection.SelectionPopupControllerImpl.S (chromium-Monochrome.aab-stable-636711321:381)
fF3.a (chromium-Monochrome.aab-stable-636711321:38)
CR3.k (chromium-Monochrome.aab-stable-636711321:7)
gm.run (chromium-Monochrome.aab-stable-636711321:17)
android.os.MessageQueue.nativePollOnce (MessageQueue.java)

com.android.internal.os.ZygoteInit.main (ZygoteInit.java:962)

I am using only the restring dependency for the local languages feature in my project.

'implementation 'dev.b3nedikt.restring:restring:5.2.2'

This is our top crash that is only occurring in Android 9 version and yes we are using WebView in our Jetpack Composed app.

Any help is appreciated @B3nedikt

Thanks.

Vamsiraj13 commented 5 months ago

@B3nedikt I am also getting a crash even though it's minor after I removed these two dependencies from my project

`'implementation 'dev.b3nedikt.viewpump:viewpump:4.0.10'

'implementation 'dev.b3nedikt.reword:reword:4.0.2'`

RestringResources.getLayout android.content.res.Resources$NotFoundException - Resource ID #

`Fatal Exception: android.content.res.Resources$NotFoundException
Resource ID #0x0
android.content.res.ResourcesImpl.getValue (ResourcesImpl.java:396)

android.content.res.Resources.getLayout (Resources.java:1348)
dev.b3nedikt.restring.internal.RestringResources.getLayout (RestringResources.kt:168)
android.view.LayoutInflater.inflate (LayoutInflater.java:551)

android.widget.ArrayAdapter.getView (ArrayAdapter.java:416)
WV.MM.getView (chromium-TrichromeWebViewGoogle6432.aab-stable-636717933:11)
android.widget.AbsListView.obtainView (AbsListView.java:2674)

com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1061)`
B3nedikt commented 5 months ago

@Vamsiraj13 If you use restring and the appcompat library, you need to also use these two dependencies, else restring won't work.

Vamsiraj13 commented 5 months ago

@B3nedikt Thanks for the quick response.

Yes, I am using appcompat library. The first crash that I mentioned is happening even though I have added the other two dependencies.