← Back to list

The Android Crash That Only Happened on Certain Phones

How to use Crashlytics to isolate and fix OEM-specific resource not found exceptions

Dilipchandar in ProAndroidDev · 2026-07-06 15:44 · 15 claps · 3.6 min read
#android #android-app-development #programming #technology #firebase
Open on Medium ↗
Wiki topics: 💻 · Programming

The Android Crash That Only Happened on Certain Phones

How to use Crashlytics to isolate and fix OEM-specific resource not found exceptions

As Android Developers, we will use resources like icons, colors, and fonts, etc in our app as per the requirement. While creating a feature and testing it on our available emulators or real devices, we may not face it. And based on the geography we are located in, we may only have devices like Pixel, Samsung, Xiaomi, and OnePlus. And some device manufacturers may stop manufacturing new devices, and those can become obsolete. After pushing the app to production, a common way for developers is to use **Firebase Crashlytics** to see how the app is performing. It will show you crash rates, active users, latest app release monitoring, etc.

Since this article is not about setting up a Firebase account and getting access to our project, the assumption is that we have Firebase access.

Step 1: Identify the crash

I got this one in my stack trace Fatal Exception: android.content.res.Resources$NotFoundException

Font resource ID #0x7f09000d could not be retrieved.

Looking at the issue by definition **Resources.NotFoundException**, we can sense that some resources are not loaded correctly or could not be retrieved.

Next, we can check which file it was referring to. In my case it was R.font.semibold

Step 2: Check the exact root cause

When I located the source file causing the issue, the following code was present in the XML file

<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
        app:fontProviderAuthority="com.google.android.gms.fonts"
        app:fontProviderPackage="com.google.android.gms"
        app:fontProviderQuery="name=Roboto&amp;weight=500"
        app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>

We have two options to use Fonts in Android

  1. Downloading fonts from online and keep it locally -> create a folder named font in our Android Studio project -> paste the custom font from our directory -> for example, Roboto.ttf

If you see the font directory, it has fonts with extension .ttf and those are downloaded and read inside our project directly.

  1. Using downloadable fonts from Google Play Services (our scenario)

Kotlin code where the semibold.xml is used

val custom = ResourcesCompat.getFont(context, R.font.semibold)?.let 
             { TypefaceSpan(it) }

ResourcesCompat.getFont() does not simply read a local .ttf. Instead it:

  1. Connects to Google Play Services.
  2. Requests the font.
  3. Downloads or retrieves it from cache.
  4. Returns the Typeface.

Step 3: Use Crashlytics to identify if it is OEM-specific

The above figure from Crashlytics shows that the crash occurred only on Huawei devices. Now, it is a little relief for us that this issue is device-specific (or Original Equipment Manufacturer-specific) and the impact is not for all of our users.

Step 4: Solution

Two possible solutions are identified and explained below

A naive and quick workaround will be to wrap the code with a try-catch block

val typeface = try {
    ResourcesCompat.getFont(context, R.font.semibold)
} catch (e: Exception) {
    Log.e("Tag", "Unable to load downloadable font")
}

This prevents the crash and falls back gracefully. But it is a temporary solution until we can ship the font locally.

Use the clue of device brand Huawei

Many Huawei devices (especially those released after the U.S. trade restrictions) do not ship with Google Mobile Services (GMS). Instead, they use Huawei Mobile Services (HMS).

On Huawei devices without GMS:

  • the Google Fonts Provider may not exist,
  • or it cannot be contacted

so Android throws:

Resources$NotFoundException:
Font resource ID ... could not be retrieved.

Instead of using Downloadable Fonts.

  1. Download the Roboto Medium font (or whichever weight you need).
  2. Place it in res/font/roboto_medium.ttf

Our code will be

ResourcesCompat.getFont(context, R.font.roboto_medium)

And by doing it like above, the font is packaged inside the APK and works

  • Huawei or other OEMs
  • Offline
  • Without Google Play Services

Firebase Crashlytics is a powerful tool that we can use to filter the crashes based on the latest app version, Android OS version, device states like background, etc., as shown in the image below

Key takeaway:

Knowing the exact root cause of the issue can help us fix the issue faster. It is not always possible to reproduce the production incidents in our local environment. In such cases, it is better to see how we can provide a temporary workaround until we get a permanent solution. At the end of the day, the crash rates of our app should be low. It is always a better experience for the user to see a minor UI bug or a warning dialog instead of a fatal crash that can annoy users and force them to uninstall our app.

Hope this article is a good read. Thanks for reading this article.

Also, if you like to support me through https://buymeacoffee.com/dilipchandar, please do.

Let’s connect on LinkedIn: https://www.linkedin.com/in/dilip-chandar-97570158?


메타데이터
post_id
16ce2effe84e
slug
the-android-crash-that-only-happened-on-certain-phones-16ce2effe84e
url
https://proandroiddev.com/the-android-crash-that-only-happened-on-certain-phones-16ce2effe84e
canonical_url
https://proandroiddev.com/the-android-crash-that-only-happened-on-certain-phones-16ce2effe84e
author_url
https://medium.com/@dilipchandar89
status
ok
fetched_at
2026-07-08 20:12:56