Quantcast
Channel: Question and Answer » libgdx
Viewing all articles
Browse latest Browse all 434

LibGDX – Can't read .ttf file when running Android configuration

$
0
0

when running or debugging my game on android device, i get this error in the logcat:

com.badlogic.gdx.utils.GdxRuntimeException: Error reading file: data/fonts/myFont.ttf (Internal)

which is created by this code line

FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile);

where fontFile is defined like this:

FileHandle fontFile = Gdx.files.internal("data/fonts/myFont.ttf");

This doesn’t happen when i run the desktop configuration.

I know that for desktop configuration you have to define the working directory of your project, but i don’t see such option in android configuration and it also makes no sense so i don’t think it’s a “working directory” related problem.

Obviously, the file is in the correct path.

Also note that everything worked fine in my previous project. I created this new project by creating a new blank prj using libgdx-setup and then copying all classes and packages from the older project. So maybe is a problem related to some gradle file?


Viewing all articles
Browse latest Browse all 434

Trending Articles