java – Libgdx cannot learn .ttf file when operating Android configuration

java – Libgdx cannot learn .ttf file when operating Android configuration

[ad_1]

Firstly, I’m conscious {that a} related query was requested a while in the past that went unanswered. At present, it has a number of upvotes however no reply.

The error

com.badlogic.gdx.utils.GdxRuntimeException: Error studying file: knowledge/font/font1.ttf (Inside)
...
Brought on by: java.io.FileNotFoundException: font/font1.ttf

happens after I use the category FreeTypeFontGenerator offered by Libgdx as a extension to make use of freetype fonts(hyperlink). That is the road in my challenge that prompted error:

FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.information.inner("font/font1.ttf"));

I will be pretty sure that my path to the .ttf is right, because the desktop configuration runs completely, exhibiting the font as desired.

My guess: I did not embrace the freetype extension when creating this libgdx challenge. When following the tutorial to incorporate it (that’s, including the freetype dependencies in construct.gradle), one thing by some means went unsuitable. However even this isn’t convincing sufficient.

construct.gradle:

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


    dependencies {
        compile challenge(":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"



    }
}

challenge(":android") {
    apply plugin: "android"

    configurations { natives }

    dependencies {
        compile challenge(":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"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"


    }
}

[ad_2]

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply