Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
577 views
in Technique[技术] by (71.8m points)

java - Font resource could not be retrieved

I'm using compileSdk and targetSdk version 27 and in last release I used new font resource feature for my project but after a day I got 3 crashes for this line of code

Typeface typeface = ResourcesCompat.getFont(this, R.font.my_font);

and the crash report says it's because of android.content.res.Resources$NotFoundException and Font resource could not be retrieved. All 3 crashes happened for users with android version 5.1.1. Is this a bug in support library or I'm doing something wrong?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I got the same crash while using Downloadable fonts on API level 16 with Google Play services 9.2.56 (emulator).

If you're using this, then a device must have Google Play services version 11 or higher to use the Google Fonts provider (see this note in the docs).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...