I am trying to render simple text using the libgdx BitmapFont
:
font = new BitmapFont();
font.draw(batch, "Tap anywhere to begin!", 100, 100);
It works fine in the desktop,But android it gives this error:
07-30 08:12:35.518: ERROR/AndroidRuntime(817): FATAL EXCEPTION: GLThread 82
com.badlogic.gdx.utils.GdxRuntimeException: File not found: com/badlogic/gdx/utils/arial-15.fnt (Classpath)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:132)
at com.badlogic.gdx.backends.android.AndroidFileHandle.read(AndroidFileHandle.java:77)
at com.badlogic.gdx.graphics.g2d.BitmapFont$BitmapFontData.<init>(BitmapFont.java:715)
at com.badlogic.gdx.graphics.g2d.BitmapFont.<init>(BitmapFont.java:114)
at com.badlogic.gdx.graphics.g2d.BitmapFont.<init>(BitmapFont.java:73)
at com.mangokidzee.amphibian.Activity1.create(Activity1.java:23)
at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:322)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1505)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
Seems it is unable to load the font file
File not found: com/badlogic/gdx/utils/arial-15.fnt (Classpath)
I am using intelliJ Idea
not the Eclipse IDE. I think this is due to some path configuration issue but not able to figure out what. Can someone help me out?
Update
I have opened sample libgdx demo apk created using eclipse
, it has these 4 files in the gdx utils
folder
whereas in my apk generated using intelliJ
, it has only 2 files
arial-15
is missing.
After I removed the gdx-sources.jar from main lib dir,every thing works fine. Maybe a bug of IntelliJ IDEA?
Link the assets between Android module and Main module:
Create a directory named data in the main module, and make a sym-link from the assets directory in the Android module.
Here's the reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With