As part of supporting new downloadable fonts in Oreo and in the support library, I began to incorporate functionality into the applications that I am developing. The first application was successful - a simple application with several actions. The second application was unsuccessful. After adding downloadable fonts (based on this resource: https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts.html ) I encounter this error when starting the action:
01-05 13:48:50.849 1112-16753/? I/ActivityManager: Start proc 22862:com.android.chrome:sandboxed_process0/u0i247 for webview_service edu.bsu.android.apps.traveler/org.chromium.content.app.SandboxedProcessService0 01-05 13:48:51.047 22862-22862/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.android.chrome:sandboxed_process0, PID: 22862 android.content.res.Resources$NotFoundException: Array resource ID
The application does not crash, but a message appears twice that βChrome is stoppedβ - reopen the application or send feedback.
Based on stacktrace, resource identifier #0x7f030030 is the following entry in R.java (what I expect):
public static final int preloaded_fonts=0x7f030030;
I suppose I determined the cause of the error - again, the error is that Chrome has a problem, but still this happens in my application:
- The layout for the action contains a
TextView with the autoLink attribute for "web", "map" or "all". - I preload the fonts in the manifest based on the document above.
Eliminating either the preload declaration in the manifest or removing the autoLink attribute resolves the issue. TextViews that do not use "web", "map" or "all" for the autoLink attribute autoLink not generate an error (the "phone" works, which I expect, since this is not the basis for the Internet), Obviously, none of them is the perfect solution. This only happens when you first start the application.
Again, the first application worked perfectly with the same fonts, preloading the manifest and using the autoLink attribute. However, there are differences between working and non-working applications:
- A non-working application is a large application, so it uses the multidex library, but a working application does not.
- A non-working application is localized and intended for several devices, therefore it includes both directories in English and German,
values , as well as directories of values , depending on the screen size. A working application does not use multiple values resource folders.
To solve this problem, I tried the following:
- Thinking that the ResourceID is in conflict with something, I created a new resource for the font array that created the new identifier. An error has still occurred.
- Added XML file of font array to all
values folder in the project, regardless of screen size or localization. An error has still occurred. - I tried different fonts and only one font. An error has still occurred.
- Removed the value "web", "map" and "all"
autoLink from TextViews . The error has disappeared. - Removed the
preload_fonts meta tag from the manifest. The error has disappeared.
I found that the problem associated with this problem is somewhat related to this problem (I am the last of the comments on the tracker, but before I fully understood the complexity of the problem): https://issuetracker.google.com/u/1 / issues / 65575496
I tested the error-generating application on the following devices, and the "Chrome stopped" error only appears on Oreo devices. A "simple" application works on all devices, no errors are reported.
- Pixel 2 XL, 8.1.0 - error
- Nexus 5X, 8.1.0 - error
- Nexus 6, 7.1.1 - no errors in the application
Both applications have the following gradle configurations:
compileSdkVersion 27 buildToolsVersion '27.0.3' minSdkVersion 16 targetSdkVersion 27 supportLibraryVersion = "27.0.2" playServicesVersion = "11.8.0"
Is there a solution to this problem (other, not pre-installed fonts or using the network, map, or the entire autoLink attribute) or is this related to the problem tracker mentioned earlier?