brarcher / loyalty-card-locker

Stores your barcode-based store/loyalty cards on your phone
GNU General Public License v3.0
171 stars 29 forks source link

App crashes when loading About dialog on Android 5 devices #340

Open brarcher opened 4 years ago

brarcher commented 4 years ago

Due to a bug in androidx.appcompat:appcompat versions 1.1.0 through 1.2.0-alpha01, loading the About dialog on Android 5 devices results in a crash:

FATAL EXCEPTION: ControllerMessenger
Process: protect.card_locker, PID: 14560
android.content.res.Resources$NotFoundException: String resource ID #0x3040002
    at android.content.res.HwResources.getText(HwResources.java:1252)
    at android.content.res.Resources.getString(Resources.java:374)
    at com.android.org.chromium.content.browser.ContentViewCore.setContainerView(ContentViewCore.java:948)
    at com.android.org.chromium.content.browser.ContentViewCore.initialize(ContentViewCore.java:848)
    at com.android.org.chromium.android_webview.AwContents.createAndInitializeContentViewCore(AwContents.java:649)
    at com.android.org.chromium.android_webview.AwContents.setNewAwContents(AwContents.java:788)
    at com.android.org.chromium.android_webview.AwContents.<init>(AwContents.java:635)
    at com.android.org.chromium.android_webview.AwContents.<init>(AwContents.java:573)
    at com.android.webview.chromium.WebViewChromium.initForReal(WebViewChromium.java:315)
    at com.android.webview.chromium.WebViewChromium.access$100(WebViewChromium.java:100)
    at com.android.webview.chromium.WebViewChromium$1.run(WebViewChromium.java:267)
    at com.android.webview.chromium.WebViewChromium$WebViewChromiumRunQueue.drainQueue(WebViewChromium.java:127)
    at com.android.webview.chromium.WebViewChromium$WebViewChromiumRunQueue$1.run(WebViewChromium.java:114)
    at com.android.org.chromium.base.ThreadUtils.runOnUiThread(ThreadUtils.java:144)
    at com.android.webview.chromium.WebViewChromium$WebViewChromiumRunQueue.addTask(WebViewChromium.java:111)
    at com.android.webview.chromium.WebViewChromium.init(WebViewChromium.java:264)
    at android.webkit.WebView.<init>(WebView.java:548)
    at android.webkit.WebView.<init>(WebView.java:483)
    at android.webkit.WebView.<init>(WebView.java:466)
    at android.webkit.WebView.<init>(WebView.java:453)
    at android.webkit.WebView.<init>(WebView.java:443)
    at protect.card_locker.MainActivity.displayAboutDialog(MainActivity.java:343)
    at protect.card_locker.MainActivity.onOptionsItemSelected(MainActivity.java:291)

The root cause of the bug is this change: https://android.googlesource.com/platform/frameworks/support/+/26079d87c79a64829f036236353fac1dae4e0613%5E%21/#F2

sAlwaysOverrideConfiguration forces updating the Resources configuration and thereby messes up the webview inflation on older devices.

A fix in appcompat will be available in 1.2.0-alpha02. As of this writing, that version has not yet been released.

TheLastProject commented 4 years ago

1.2.0-alpha02 is out now: https://developer.android.com/jetpack/androidx/releases/appcompat

brarcher commented 4 years ago

True. But I'm a little hesitant to rely on an alpha version. The problem is pretty limited (does not affect a critical user journey in the app, and is only on Android 5). To avoid potential breakage to other parts of the app (as it is an alpha version), it may be better to wait for a release.