On Android Studio Dolphin 2021.3.1 SDK 33, out of the blue, I’ve encountered a render problem error with any web font: "File app/src/main/res/font/rubik_bold.xml does not exist (or is not a file)".
Refreshing the layout doesn’t help. I’ve tried clean and rebuild, Gradle sync and invalidating the cache. Nothing worked. The font is preloaded, the file exists. The folder is accessible. The files are not corrupted or anything. I’ve even deleted the font files and redownloaded them via Android Studio Design view.
4
Answers
The issue has been partially fixed on Electric Eel 2022.1.1 Patch 1. You have to delete the font folder and redownload the font.
The easiest way is to go to a layout file, go to Design, select a text box and in the fontFamily attribute, select More Fonts. Search for the font family you wish and install all missing fonts.
Refresh the layout by clicking the "Try to refresh the layout" option if it does not load by itself.
I have found a work around this, android studio is not recognising fonts(some with medium, bold forexample rubik_medium), please remove those fonts and the preview will work utilize the error warning in the top corner of preview window. i have found non xml fonts working seemlessly eg. .ttf fonts
From the history at https://issuetracker.google.com/issues/248473636, it appears that this issue has been addressed in Electric Eel Beta 4 and Flamingo Canary 7.
Check inside
rubik_bold.xml
if you have a valid font defined in theandroid:font
tag and also make sure that you are not accessing the same file in that tag(eg android:font=@font/rubik_bold)
.