FileNotFoundException when loading a font file

Forum for the Android Game Development Workshop. See

FileNotFoundException when loading a font file

Postby Walla » Wed Jul 15, 2015 6:58 am

Hello everyone here in the LibGDX community,

first-poster here :)

I have a problem running the android project of my game, i explained everything in this question here

The problem started when i wanted to change my whole project name (in order to change the app's name too). Not finding solutions on how to do that online, i proceeded to do it by myself :roll:
I created a new project in another folder by using the project-creator GUI from LibGDX website. Then, with both Android Studio windows opened, i moved all the classes from one project to the other.
I resolved few errors in the imports sections and voilà, no errors when making/building the project.
Desktop version runs flawlessy but when i launch android version on my phone, it gives error when loading the .ttf font for the FreeTypeFontGenerator (i don't use FreeTypeFontGenerator itself but this "extended version"

The logcat error is this:
Code: Select all
com.badlogic.gdx.utils.GdxRuntimeException: Error reading file: data/fonts/myFont.ttf (Internal)

and the cause is this:
Code: Select all
Caused by: data/fonts/myFont.ttf at android.content.res.AssetManager.openAsset(Native Method) at at‌​75)

So it seems that it couldn't find the file.. :|
My file handle is this:
Code: Select all
FileHandle fontFile = Gdx.files.internal("data/fonts/myFont.ttf");

I'm sure the file is in the correct folder (..assets/data/fonts/myFont.ttf), because when running desktop i have no problem at all.

If anyone could help me, i will really appreciate that! :oops: :oops:
Posts: 8
Joined: Wed Jul 15, 2015 6:33 am

Re: FileNotFoundException when loading a font file

Postby MrBojangles » Sat Aug 06, 2016 2:37 am

Have you tried other fonts?
Posts: 1
Joined: Sat Aug 06, 2016 2:34 am

Re: FileNotFoundException when loading a font file

Postby Darcy357 » Wed Jan 02, 2019 11:55 am


Try to use another ttf file instead to test your code. It must be something wrong with the file.

Or you can include a ttf file directly from a file:


Posts: 1
Joined: Mon Oct 29, 2018 7:48 am

Return to Android Game Development Workshop

Who is online

Users browsing this forum: No registered users and 1 guest