I have made an app which uses a custom .ttf font. Unfortunately this font only works in the Android emulator. On my Samsung A52s phone (Android 14, One UI 6.1) it shows the default font.
- Removing the app and install it again had no effect
- Clearing the app cache had no effect
- Using another font had no effect
- Renaming the app bundle id e.g.
com.company.app
tocom.company.app2
has no effect - Installing another app with the same font, shows the font without any issue
- On iOS both the simulator and iPhone show the font without any issue
flutter clean
had no effect- Rebuilding the app had no effect
- Upgrading Android on the phone had no effect
- Reboot had no effect
When you Google for "Flutter custom font not working" you get issues where the custom font did not work at all. In my case it is just the Android Phone.
Has anyone experienced the same?
2
Answers
This is super weird. When I removed the:
From my theme it worked. Then when I restored the exact same code it worked as well.
To add a font to text you need to add font files in assets, mention those font and font family in
pubspec.yaml
file (check indentation) and then applying font usingtextStyle
.if you are using
GoogleFonts
package then you must giveInternet
permission inmanifest
file to make it work.