Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
Thank you for reporting this issue. For us to further investigate this issue, please provide the following additional information:
Android build
Which Android build are you using? (e.g. OPP1.170223.012)
Device used
Which device did you use to reproduce this issue?
Steps to reproduce
What steps are needed to reproduce this issue?
Please provide sample project or apk to reproduce the issue. Also mention the steps to be followed for reproducing the issue with the given sample project or apk.
Android bug report capturing
After reproducing the issue, press the volume up, volume down, and power button simultaneously. This will capture a bug report on your device in the “bug reports” directory. Attach the bug report file to this issue.
Alternate method
After reproducing the issue, navigate to “developer settings”, ensure “USB debugging” is enabled, then enable “Bug report shortcut”. Capture bug report by holding the power button and selecting the “Take bug report” option.
Screen capture of the issue
Press the volume down and power buttons simultaneously. The image will appear in your gallery. Attach the screenshot file to this issue.
NOTE : To avoid leaking private information, please share screenshots and bugreports only in Google Drive. Share files with android-bugreport@google.com and include only Google drive links in your bug. Bug report attachments should not be included directly in issue reports.
Android build
Which Android build are you using? (e.g. OPP1.170223.012)
Device used
Which device did you use to reproduce this issue?
Steps to reproduce
What steps are needed to reproduce this issue?
Please provide sample project or apk to reproduce the issue. Also mention the steps to be followed for reproducing the issue with the given sample project or apk.
Android bug report capturing
After reproducing the issue, press the volume up, volume down, and power button simultaneously. This will capture a bug report on your device in the “bug reports” directory. Attach the bug report file to this issue.
Alternate method
After reproducing the issue, navigate to “developer settings”, ensure “USB debugging” is enabled, then enable “Bug report shortcut”. Capture bug report by holding the power button and selecting the “Take bug report” option.
Screen capture of the issue
Press the volume down and power buttons simultaneously. The image will appear in your gallery. Attach the screenshot file to this issue.
NOTE : To avoid leaking private information, please share screenshots and bugreports only in Google Drive. Share files with android-bugreport@google.com and include only Google drive links in your bug. Bug report attachments should not be included directly in issue reports.
il...@google.com <il...@google.com>
jd...@gmail.com <jd...@gmail.com> #4
Attached is a sample project that demonstrates the issue in two ways:
- when long pressing text (e.g. the headline)
- when opening a select
Both will ultimately load an alert dialog with a list adapter that has the layout ids for the content set to 0.
https://drive.google.com/file/d/1Fe2ym2F0o4XWEDHvKY8-UzpvSJq4wbWq/view?usp=drive_web (WebViewAppCompatBug.zip)
This is reproducible on an API 21 emulator (Nexus 5 configuration, no Chrome installed).
NB There is a second issue when loading the web view in the first place which in this sample project is worked around by using a resource wrapper. This is already reported underhttps://issuetracker.google.com/issues/140884278 and the attached project will also display this error when commenting out lines 13-15 in MainActivity.kt.
- when long pressing text (e.g. the headline)
- when opening a select
Both will ultimately load an alert dialog with a list adapter that has the layout ids for the content set to 0.
This is reproducible on an API 21 emulator (Nexus 5 configuration, no Chrome installed).
NB There is a second issue when loading the web view in the first place which in this sample project is worked around by using a resource wrapper. This is already reported under
zh...@google.com <zh...@google.com> #5
Please take a look at this issue and provide your inputs.
zh...@google.com <zh...@google.com> #6
Wrapping Resources is not supported by the framework and you must not create your own instances of Resources at all (the APIs to do so are now marked deprecated after they were accidentally exposed).
We can't do anything to fix this - you need to solve the underlying problem with appcompat and stop wrapping it like this, and then resources will work.
We can't do anything to fix this - you need to solve the underlying problem with appcompat and stop wrapping it like this, and then resources will work.
jd...@gmail.com <jd...@gmail.com> #7
While I agree this is WontFIx from WebView's perspective (the WebView APK in question already shipped), it seems like this should still be considered a regression from appcompat's perspective, given the community can no longer test on lower-level emulators. We've received several unique user reports of this issue, not to mention the internal reports which led to filing issue 139710458 .
Surprisingly, issue 142086375 claims this bug repros on Marshmallow, which is something we haven't observed so far and doesn't fit into the current hypothesis:
> in Android 6.0 (API 23) it crashes on tapping the <select> element.
---
From issue 141132133 :
> This change is the root cause:https://android.googlesource.com/platform/frameworks/support/+/26079d87c79a64829f036236353fac1dae4e0613%5E%21/#F2
>
> sAlwaysOverrideConfiguration forces updating the Resources configuration and therby messing up the webview inflation on older devices.
Chis, any chance this checks out? I didn't look too closely into this, so I'm not sure if there are consequences to not overriding the configuration on L-M only, or perhaps further limited old WebView versions only.
Surprisingly,
> in Android 6.0 (API 23) it crashes on tapping the <select> element.
---
From
> This change is the root cause:
>
> sAlwaysOverrideConfiguration forces updating the Resources configuration and therby messing up the webview inflation on older devices.
Chis, any chance this checks out? I didn't look too closely into this, so I'm not sure if there are consequences to not overriding the configuration on L-M only, or perhaps further limited old WebView versions only.
ap...@google.com <ap...@google.com> #8
Same problem appear simply by using a WebView on Android 5 / 5.1 (on actual devices, no emulator) with appcompat:1.1.0 directly causing a crash (on display, no interaction needed).
jb...@google.com <jb...@google.com> #9
Dropping the priority of this, since there's no feasible fix for this.
vs...@gmail.com <vs...@gmail.com> #10
So, a bug that was laser-focused and easily reproduced by simply including a WebView in an Activity crashing on Android 5 / 5.1 devices with appcompat-1.1.0 but not appcompat-1.1.0-rc01 was marked as duplicate of this, and somehow despite knowing the commit that caused it and being able to reproduce it, and not crashing from Android 5 until that commit it is not feasible to fix. Seems odd to me given the commit seemed to enable a feature, meaning that the choice is crash or have a feature (which you can't use because you crashed). Wouldn't it be better to just not support that feature fully vs crash? Just a thought
ba...@gmail.com <ba...@gmail.com> #11
We got this crash on a Samsung Nexus 10 with Android 5.1.1 at 100% on any WebView
to...@yahoo.com <to...@yahoo.com> #12
Can this be changed back to p2 priority? Phrase "no feasible fix" is not enouth to ignore application crash and make this less importaint
[Deleted User] <[Deleted User]> #13
I'm not sure if you can see the duplicate of this ticket. We have lots of tickets which have different causes of the WebView crashes are marked as duplicate with no clarification.
Here is one of them.
https://issuetracker.google.com/issues/141436946
It will be great if you can take some time to revisit duplicate tickets. I believe a lot of developer are looking for the fix or workaround.
Thank you!
Here is one of them.
It will be great if you can take some time to revisit duplicate tickets. I believe a lot of developer are looking for the fix or workaround.
Thank you!
ce...@gmail.com <ce...@gmail.com> #14
Hi, i have same issue in android 22 and 23. Any update?
to...@yahoo.com <to...@yahoo.com> #15
+1, I'm getting the same issue
ce...@gmail.com <ce...@gmail.com> #16
I've tried downgrading like you suggested, and it's working for Android 23 but not 22, and the error message changes to:
W/System.err: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
at android.view.ViewRootImpl.setView(ViewRootImpl.java:566)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:282)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
at android.app.Dialog.show(Dialog.java:298)
at com.android.org.chromium.content.browser.input.SelectPopupDialog.show(SelectPopupDialog.java:133)
at com.android.org.chromium.content.browser.ContentViewCore.showSelectPopup(ContentViewCore.java:2229)
at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:53)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
W/System.err: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
at android.view.ViewRootImpl.setView(ViewRootImpl.java:566)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:282)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
at android.app.Dialog.show(Dialog.java:298)
at com.android.org.chromium.content.browser.input.SelectPopupDialog.show(SelectPopupDialog.java:133)
at com.android.org.chromium.content.browser.ContentViewCore.showSelectPopup(ContentViewCore.java:2229)
at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:53)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
lb...@gmail.com <lb...@gmail.com> #17
Same issue, SDK 21 with androidx.appcompat 1.1.0
lb...@gmail.com <lb...@gmail.com> #19
+1 same here
lb...@gmail.com <lb...@gmail.com> #21
Hi given there are quite a few issues with higher priority/severity marked as dup of this issue, can someone bump up the priority/severity of this issue?
ca...@gmail.com <ca...@gmail.com> #22
Add a trivial repro case
This is a project created by New Android Project -> Blank Activity -> Add WebView to layout/main_activity.xml, run on API21 emulator and it crashes with the following trace
11-27 14:12:26.160 3218-3218/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.crashingwebview, PID: 3218
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.crashingwebview/com.example.crashingwebview.MainActivity}: android.view.InflateException: Binary XML file line #17: Error inflating class android.webkit.WebView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class android.webkit.WebView
at android.view.LayoutInflater.createView(LayoutInflater.java:633)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at com.example.crashingwebview.MainActivity.onCreate(MainActivity.kt:10)
at android.app.Activity.performCreate(Activity.java:5937)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at com.example.crashingwebview.MainActivity.onCreate(MainActivity.kt:10)
at android.app.Activity.performCreate(Activity.java:5937)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x2040002
at android.content.res.Resources.getText(Resources.java:274)
at android.content.res.Resources.getString(Resources.java:360)
at com.android.org.chromium.content.browser.ContentViewCore.setContainerView(ContentViewCore.java:702)
at com.android.org.chromium.content.browser.ContentViewCore.initialize(ContentViewCore.java:608)
at com.android.org.chromium.android_webview.AwContents.createAndInitializeContentViewCore(AwContents.java:619)
at com.android.org.chromium.android_webview.AwContents.setNewAwContents(AwContents.java:758)
at com.android.org.chromium.android_webview.AwContents.<init>(AwContents.java:608)
at com.android.org.chromium.android_webview.AwContents.<init>(AwContents.java:546)
at com.android.webview.chromium.WebViewChromium.initForReal(WebViewChromium.java:312)
at com.android.webview.chromium.WebViewChromium.access$100(WebViewChromium.java:97)
at com.android.webview.chromium.WebViewChromium$1.run(WebViewChromium.java:264)
at com.android.webview.chromium.WebViewChromium$WebViewChromiumRunQueue.drainQueue(WebViewChromium.java:124)
at com.android.webview.chromium.WebViewChromium$WebViewChromiumRunQueue$1.run(WebViewChromium.java:111)
at com.android.org.chromium.base.ThreadUtils.runOnUiThread(ThreadUtils.java:144)
at com.android.webview.chromium.WebViewChromium$WebViewChromiumRunQueue.addTask(WebViewChromium.java:108)
at com.android.webview.chromium.WebViewChromium.init(WebViewChromium.java:261)
at android.webkit.WebView.<init>(WebView.java:548)
at android.web
changing appcompat library version to 1.1.0-rc01, the app launches with an empty webview without crashing.
This is a project created by New Android Project -> Blank Activity -> Add WebView to layout/main_activity.xml, run on API21 emulator and it crashes with the following trace
11-27 14:12:26.160 3218-3218/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.crashingwebview, PID: 3218
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.crashingwebview/com.example.crashingwebview.MainActivity}: android.view.InflateException: Binary XML file line #17: Error inflating class android.webkit.WebView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class android.webkit.WebView
at android.view.LayoutInflater.createView(LayoutInflater.java:633)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at com.example.crashingwebview.MainActivity.onCreate(MainActivity.kt:10)
at android.app.Activity.performCreate(Activity.java:5937)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at com.example.crashingwebview.MainActivity.onCreate(MainActivity.kt:10)
at android.app.Activity.performCreate(Activity.java:5937)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x2040002
at android.content.res.Resources.getText(Resources.java:274)
at android.content.res.Resources.getString(Resources.java:360)
at com.android.org.chromium.content.browser.ContentViewCore.setContainerView(ContentViewCore.java:702)
at com.android.org.chromium.content.browser.ContentViewCore.initialize(ContentViewCore.java:608)
at com.android.org.chromium.android_webview.AwContents.createAndInitializeContentViewCore(AwContents.java:619)
at com.android.org.chromium.android_webview.AwContents.setNewAwContents(AwContents.java:758)
at com.android.org.chromium.android_webview.AwContents.<init>(AwContents.java:608)
at com.android.org.chromium.android_webview.AwContents.<init>(AwContents.java:546)
at com.android.webview.chromium.WebViewChromium.initForReal(WebViewChromium.java:312)
at com.android.webview.chromium.WebViewChromium.access$100(WebViewChromium.java:97)
at com.android.webview.chromium.WebViewChromium$1.run(WebViewChromium.java:264)
at com.android.webview.chromium.WebViewChromium$WebViewChromiumRunQueue.drainQueue(WebViewChromium.java:124)
at com.android.webview.chromium.WebViewChromium$WebViewChromiumRunQueue$1.run(WebViewChromium.java:111)
at com.android.org.chromium.base.ThreadUtils.runOnUiThread(ThreadUtils.java:144)
at com.android.webview.chromium.WebViewChromium$WebViewChromiumRunQueue.addTask(WebViewChromium.java:108)
at com.android.webview.chromium.WebViewChromium.init(WebViewChromium.java:261)
at android.webkit.WebView.<init>(WebView.java:548)
at android.web
changing appcompat library version to 1.1.0-rc01, the app launches with an empty webview without crashing.
il...@google.com <il...@google.com> #23
The issue is a bug in old versions of WebView (most of which are installed in API 21-22ish), which AppCompat doesn't have any control over. The background is that those versions of WebView seem to crash if an app uses ContextThemeWrapper.applyOverrideConfiguration(), which AppCompat now uses quite heavily (as of v1.1.0-alpha03), especially for DayNight. The commit linked from #7 is actually a symptom rather than the cause. That commit just makes AppCompat use applyOverrideConfiguration() in more places, which then triggers the WebView issue. The same thing would happen if the app uses applyOverrideConfiguration() themselves, so reverting all of the changes in AppCompat would just cause more problems than it fixes.
Anyway, I've found a workaround which I *think* works, at least the tests are now all passing on API 21/22. Apologies for the delay in reaching this. It unfortunately wasn't an easy bug to find a workaround for.
Pending CL:https://android-review.googlesource.com/c/platform/frameworks/support/+/1177665
Anyway, I've found a workaround which I *think* works, at least the tests are now all passing on API 21/22. Apologies for the delay in reaching this. It unfortunately wasn't an easy bug to find a workaround for.
Pending CL:
ar...@gmail.com <ar...@gmail.com> #24
I tracked this issue into WebView and ContextThemeWrapper a bit as well when I encountered this problem. It seemed to me to be more of a applyOverrideConfiguration bug than a WebView bug. I noticed that after calling applyOverrideConfiguration, `Context.getAssets()` and `Context.getResources().getAssets()` are not returning the same AssetManager object. The AssetManager returned from `Context.getAssets()` can't access resources in other packages (including the system WebView package), causing WebView to crash. If I override `Context.getAssets()` to return `getResources().getAssets()`, the problem is gone.
Besides, `Context.getAssets()` and `Context.getResources().getAssets()` are returning the same object on latest versions of Android in the same condition. I found that `ContextImpl.getAssets()` is returning `getResources().getAssets()` in the latest source code.
Besides, `Context.getAssets()` and `Context.getResources().getAssets()` are returning the same object on latest versions of Android in the same condition. I found that `ContextImpl.getAssets()` is returning `getResources().getAssets()` in the latest source code.
ar...@gmail.com <ar...@gmail.com> #25
#24: Good detective work! Yeah, the CL I listed above moves us to using createConfigurationContext(), which seems to be better supported on earlier versions of Android, so hopefully this issue disappears once the CL is in.
ar...@gmail.com <ar...@gmail.com> #26
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 0850be80d556fc23a6f39a094c923665c24e3de2
Author: Chris Banes <chrisbanes@google.com>
Date: Thu Nov 28 16:39:07 2019
DayNight rewrite v2.5
We've now moved to using createConfigurationContext(),
instead of applyOverrideConfiguration(). Certain older versions
of WebView have an issue when an app uses
applyOverrideConfiguration(), but they seem to work fine
using createConfigurationContext() /shruggie.
To use createConfigurationContext(), I've had to refactor a
lot of updateNightMode() code to also have another entry
point which returns a Context for attachBaseContext().
Test: ./gradlew appcompat:connectedCheck
BUG: 141351441
Change-Id: I7a5b59071f82b79820c6df695bfa622d727f2030
M appcompat/appcompat/api/1.2.0-alpha01.txt
M appcompat/appcompat/api/current.txt
M appcompat/appcompat/api/public_plus_experimental_1.2.0-alpha01.txt
M appcompat/appcompat/api/public_plus_experimental_current.txt
M appcompat/appcompat/src/main/java/androidx/appcompat/app/AppCompatActivity.java
M appcompat/appcompat/src/main/java/androidx/appcompat/app/AppCompatDelegate.java
M appcompat/appcompat/src/main/java/androidx/appcompat/app/AppCompatDelegateImpl.java
M samples/Support7Demos/src/main/res/layout/appcompat_night_mode.xml
M samples/Support7Demos/src/main/res/values/strings.xml
https://android-review.googlesource.com/1177665
Branch: androidx-master-dev
commit 0850be80d556fc23a6f39a094c923665c24e3de2
Author: Chris Banes <chrisbanes@google.com>
Date: Thu Nov 28 16:39:07 2019
DayNight rewrite v2.5
We've now moved to using createConfigurationContext(),
instead of applyOverrideConfiguration(). Certain older versions
of WebView have an issue when an app uses
applyOverrideConfiguration(), but they seem to work fine
using createConfigurationContext() /shruggie.
To use createConfigurationContext(), I've had to refactor a
lot of updateNightMode() code to also have another entry
point which returns a Context for attachBaseContext().
Test: ./gradlew appcompat:connectedCheck
BUG: 141351441
Change-Id: I7a5b59071f82b79820c6df695bfa622d727f2030
M appcompat/appcompat/api/1.2.0-alpha01.txt
M appcompat/appcompat/api/current.txt
M appcompat/appcompat/api/public_plus_experimental_1.2.0-alpha01.txt
M appcompat/appcompat/api/public_plus_experimental_current.txt
M appcompat/appcompat/src/main/java/androidx/appcompat/app/AppCompatActivity.java
M appcompat/appcompat/src/main/java/androidx/appcompat/app/AppCompatDelegate.java
M appcompat/appcompat/src/main/java/androidx/appcompat/app/AppCompatDelegateImpl.java
M samples/Support7Demos/src/main/res/layout/appcompat_night_mode.xml
M samples/Support7Demos/src/main/res/values/strings.xml
du...@gmail.com <du...@gmail.com> #27
This should be out in AppCompat v1.2.0-alpha02
.
If you'd like to try this now, you can try the 1.2.0-SNAPSHOT
version, available at the following repository:
repositories {
maven {
url 'https://ci.android.com/builds/submitted/6043188/androidx_snapshot/latest/repository/'
}
}
il...@google.com <il...@google.com> #28
Thanks for your time and for resolving this bug that was driving all of us crazy! We'll wait anxiously for v1.2.0-alpha02
mu...@gmail.com <mu...@gmail.com> #29
Thank you so much for resolving this! Will this ever be back ported to 1.1.*?
mu...@gmail.com <mu...@gmail.com> #30
#29: Probably not. The fix is quite invasive and moves AppCompat to using yet-another-way to implement custom configuration handling. The change itself may uncover more issues so we need some soak time in alpha.
ig...@gmail.com <ig...@gmail.com> #31
Came from this issues https://issuetracker.google.com/issues/141132133 and https://issuetracker.google.com/issues/141351441 and tried the 1.2.0-SNAPSHOT and we are still getting the android.content.res.Resources$NotFoundException: String resource ID #0x2040003 exception, any news on this particular exception?
il...@google.com <il...@google.com> #32
Hmmm, confirmed. Looks like my change didn't actually make it into the snapshot I listed above. /facepalm I just tried the latest snapshot repository available, and that is working:
androidx.appcompat:appcompat:1.2.0-SNAPSHOT
repositories {
maven {
url 'https://ci.android.com/builds/submitted/6052626/androidx_snapshot/latest/repository/'
}
}
si...@gmail.com <si...@gmail.com> #33
#32: Can confirm, the newer snapshot fixes the problem. Thank you
df...@smart-soft.com <df...@smart-soft.com> #34
I also really appreciate the effort to fix this, thank you.
I know there are lots of people getting mail on each comment, apologies, but I wanted to confirm that the fix will still be landing in 1.2.0-alpha02? I'll be ready to test it but don't waste the time if the last couple comments mean it will be in the release after alpha02 now
Thanks!
I know there are lots of people getting mail on each comment, apologies, but I wanted to confirm that the fix will still be landing in 1.2.0-alpha02? I'll be ready to test it but don't waste the time if the last couple comments mean it will be in the release after alpha02 now
Thanks!
il...@google.com <il...@google.com> #35
Yep, should be in 1.2.0-alpha02
.
The last few comments are just about the snapshots release.
Description
Component used: Activity
Version used: 1.3.0-alpha04
InvalidFragmentVersionForActivityResult
is reported though I forcedandroidx.fragment:fragment-ktx:1.3.1
.Here is my build.gradle essentials: