# Libgdx can't read .ttf file when running Android configuration

Firstly, I am aware that a similar question was asked some time ago that went unanswered. Currently, it has multiple upvotes but no answer.

The error

com.badlogic.gdx.utils.GdxRuntimeException: Error reading file: data/font/font1.ttf (Internal)
...
Caused by: java.io.FileNotFoundException: font/font1.ttf


occurs when I use the class FreeTypeFontGenerator provided by Libgdx as a extension to use freetype fonts(link). This is the line in my project that caused error:

FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("font/font1.ttf"));


I can be fairly certain that my path to the .ttf is correct, as the desktop configuration runs perfectly, showing the font as desired.

My guess: I didn't include the freetype extension when creating this libgdx project. When following the tutorial to include it (that is, adding the freetype dependencies in build.gradle), something somehow went wrong. But even this is not convincing enough.

build.gradle:

project(":desktop") {
apply plugin: "java"

dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop" compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" } } project(":android") { apply plugin: "android" configurations { natives } dependencies { compile project(":core") compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64" compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi" natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a" natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64" compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"

My actually font filename in the font folder is font1.ttf. After changing it to font.ttf, the problem resolved itself. I don't understand why it worked, as I think it is okay to include numbers and uppercase in a file name.