Project

General

Profile

Actions

Bug #192

closed

Crash on start due to missing resource in `NavigationView`

Added by Forest O over 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Next Release
Start date:
09/09/2017
Due date:
% Done:

0%

Estimated time:

Description

I just updated my LineageOS 12.1 ROM to the current version, which uses PrivacyBrowser 2.5 as its default browser. (See [url=https://forum.xda-developers.com/sony-xperia-z1-compact/orig-development/lineageos-12-1-z1c-current-sec-patches-t3614936/post72647129#post72647129]this thread[/url].)

PrivacyBrowser crashes when I attempt to start it. Clearing the app cache & data does not help.

logcat:

https://gist.github.com/anonymous/0167f7e4c2c1c4da6cc53145ad82da52

Actions #1

Updated by Soren Stoutner over 6 years ago

  • Assignee set to Soren Stoutner
  • Priority changed from 2 to 3

Thank you for the logcat.

It looks like Privacy Browser is crashing because it is missing a resource file (image, string, color, etc.). In this case, my guess is that the APK you have is corrupted, either because it is corrupted in the LineageOS ROM (although if that were the case I would expect to receive bug reports from multiple users, which so far hasn't happened), or there was a glitch in the ROM flashing process, or you have a failing flash chip in your device.

Try removing the Privacy Browser APK and reinstalling using the APK available on stoutner.com:

https://download.stoutner.com/privacy-browser/Privacy%20Browser%202.5.apk

I have just tested this APK by doing a clean install on a Nexus 4 running stock ROM and it functioned as expected.

Actions #2

Updated by Forest O over 6 years ago

I tried the APK you linked and got the same crash (and same exception in logcat).

I doubt that it's a corrupted APK, because I get the same problem with the APK you linked and the one built from source (as part of the ROM build). The F-Droid APK also crashed (presumably for the same reason) when I installed it on my previous LineageOS build.

I doubt that it's a flash chip failure, because this crash is consistent and only in PrivacyBrowser.

Actions #3

Updated by Forest O over 6 years ago

FYI, Lightning-Browser also uses WebView, and works fine.

Actions #4

Updated by Soren Stoutner over 6 years ago

  • Subject changed from Crash on start to Crash on start due to missing resource in `NavigationView`
Actions #5

Updated by Soren Stoutner over 6 years ago

This crash is not associated with `WebView`, but rather with the inflating of `android.support.design.widget.NavigationView`, which is the drawer that slides out on the left of the screen. The crash is caused because the inflater cannot find one of the resources it needs to create the drawer.

It isn't clear from the logcat which resource is causing problems. This particular `NavigationView` is populated using an XML file that contains the list of entries and a reference to the icons (using an XML file is the current recommended way to create a `NavigationView`, but it is still possible to create one using the older method instead). The system has to parse that list to create the entries. It is possible that the code that parses the list is failing in some way.

The icons for the `NavigationView` are stored as vector images instead of bitmaps. Because vector support is relatively new, not all apps use vector images. The vector images have to be converted to bitmap drawables to be displayed on the screen (the conversion program selects the ideal DPI during the conversion process match the screen's configuration). Some of the images are also auto-mirrored to account for right-to-left languages, which is an additional processing step. It is possible that one of these steps is failing and the bitmap drawables are not being created, which is causing the crash.

There might be some other aspect of the resource use of the `NavigationView` that is failing. In all these cases, the code that is producing the error is likely Android system code, not Privacy Browser code. This would lead me to believe that either the ROM update did not flash cleanly or your flash storage is failing (leading to a corruption in an Android library).

In a moment I will post on the XDA thread to see if anyone else is having the same problem.

Actions #6

Updated by Forest O over 6 years ago

Understood.

I still doubt that it is a ROM update problem or flash failure, since it has occurred on two different ROM updaes and three different APK builds, while no other app or part of the ROM is showing any sign of trouble.

Actions #7

Updated by Forest O over 6 years ago

Also, md5sum verifies that the ROM image was not corrupted. (Of course, it is conceivable that corruption could occur during image unpacking, but as I wrote already, the fact that the same problem exists across two ROM builds and three APKs makes that very unlikely to be the case here.)

Actions #9

Updated by Soren Stoutner over 6 years ago

It is possible that you are correct and it is not a ROM issue. Let's wait an see if anyone else is having the same problem.

Actions #10

Updated by Soren Stoutner over 6 years ago

From the response on the forum, it appears that the problem is specific to this one device and doesn't affect others running this ROM.

Actions #11

Updated by Forest O over 6 years ago

Mystery solved: The problem is apparently triggered when Privacy Browser is started for the first time with a non-default theme applied in the "Style" category.

Workaround: Apply the default Style in the LineageOS Theme Chooser, start Privacy Browser, and then switch back to the Style of choice.

Actions #12

Updated by Soren Stoutner over 6 years ago

  • Status changed from New to Closed

Thanks.

I didn't realize that a custom theme could cause a resource problem. I'm glad you were able to figure it out.

Actions #13

Updated by Forest O over 6 years ago

This was new to me, too. It's worth noting that the workaround apparently only has to be done once. The crash hasn't returned even though I have remained on the custom theme and restarted Privacy Browser several times.

Actions #14

Updated by Soren Stoutner over 6 years ago

Without really knowing why this happens, the most likely explanation is that the theme has difficulty working with vector icons. Support for vector icons was only added with Android 5.0, do it doesn't really come as a surprise that a theme from about this time frame would have issues supporting them. It wouldn't surprise me if Android caches the bitmap drawables that are produced from the vector images, which would explain why it works after running once with the theme disabled. If that is the case, deleting Privacy Browser's cache or data might cause the symptoms to return. But even if it does, this is a simple and effective workaround.

Actions #15

Updated by Soren Stoutner about 6 years ago

  • Priority changed from 3 to Next Release
Actions

Also available in: Atom PDF