[LibGDX] BitmapFont not working

When trying to change my font, i keep getting this error:


Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.ExceptionInInitializerError
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
Caused by: java.lang.ExceptionInInitializerError
	at com.me.main.Game.create(Game.java:113)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error loading font file: font/test.fnt
	at com.badlogic.gdx.graphics.g2d.BitmapFont$BitmapFontData.<init>(BitmapFont.java:834)
	at com.badlogic.gdx.graphics.g2d.BitmapFont.<init>(BitmapFont.java:99)
	at com.me.gui.Element.<init>(Element.java:54)
	at com.me.gui.Button.<init>(Button.java:31)
	at com.me.gui.GuiController.<clinit>(GuiController.java:27)
	... 3 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 2
	at com.badlogic.gdx.graphics.g2d.BitmapFont$BitmapFontData.<init>(BitmapFont.java:729)
	... 7 more


this is the line of code that is throwing that exception:


font=new BitmapFont(Gdx.files.internal("font/test.fnt"), false);

test.fnt:


info face="Astrofirm" size=12 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 outline=0
common lineHeight=12 base=9 scaleW=256 scaleH=256 pages=0 packed=0 alphaChnl=1 redChnl=0 greenChnl=0 blueChnl=0
chars count=10


I have put test.fnt in a folder with Astrofirm.png which holds the bitmap image

Any help is much aprreciated

Remember, needs to be in assets/font/, and you need to refresh the android project.

Yep, that’s where it is