libGdx unable to find files in android application data directory -


i'm trying access data application's data directory. i'm able load default.fnt file, tells me associated default.png cannot found. how can system recognize file? there i've setup incorrectly?

exception

07-07 22:22:52.467: e/androidruntime(10785): fatal exception: glthread 240 07-07 22:22:52.467: e/androidruntime(10785): com.badlogic.gdx.utils.gdxruntimeexception: couldn't load file: /data/data/com.iliadonline.client/files/data/gfx/fonts/default.png 07-07 22:22:52.467: e/androidruntime(10785):    @ com.badlogic.gdx.graphics.pixmap.<init>(pixmap.java:140) 07-07 22:22:52.467: e/androidruntime(10785):    @ com.badlogic.gdx.graphics.glutils.filetexturedata.prepare(filetexturedata.java:64) 07-07 22:22:52.467: e/androidruntime(10785):    @ com.badlogic.gdx.graphics.texture.load(texture.java:175) 07-07 22:22:52.467: e/androidruntime(10785):    @ com.badlogic.gdx.graphics.texture.create(texture.java:159) 07-07 22:22:52.467: e/androidruntime(10785):    @ com.badlogic.gdx.graphics.texture.<init>(texture.java:133) 07-07 22:22:52.467: e/androidruntime(10785):    @ com.badlogic.gdx.graphics.texture.<init>(texture.java:126) 07-07 22:22:52.467: e/androidruntime(10785):    @ com.badlogic.gdx.graphics.g2d.bitmapfont.<init>(bitmapfont.java:125) 07-07 22:22:52.467: e/androidruntime(10785):    @ com.badlogic.gdx.graphics.g2d.bitmapfont.<init>(bitmapfont.java:99) 07-07 22:22:52.467: e/androidruntime(10785):    @ com.iliadonline.client.render.render.loadfonts(render.java:213) 07-07 22:22:52.467: e/androidruntime(10785):    @ com.iliadonline.client.render.render.<init>(render.java:71) 07-07 22:22:52.467: e/androidruntime(10785):    @ com.iliadonline.client.iliadclient.create(iliadclient.java:65) 07-07 22:22:52.467: e/androidruntime(10785):    @ com.badlogic.gdx.backends.android.androidgraphics.onsurfacechanged(androidgraphics.java:322) 07-07 22:22:52.467: e/androidruntime(10785):    @ android.opengl.glsurfaceview$glthread.guardedrun(glsurfaceview.java:1505) 07-07 22:22:52.467: e/androidruntime(10785):    @ android.opengl.glsurfaceview$glthread.run(glsurfaceview.java:1240) 07-07 22:22:52.467: e/androidruntime(10785): caused by: com.badlogic.gdx.utils.gdxruntimeexception: error reading file: /data/data/com.iliadonline.client/files/data/gfx/fonts/default.png (internal) 07-07 22:22:52.467: e/androidruntime(10785):    @ com.badlogic.gdx.backends.android.androidfilehandle.read(androidfilehandle.java:74) 07-07 22:22:52.467: e/androidruntime(10785):    @ com.badlogic.gdx.files.filehandle.readbytes(filehandle.java:224) 07-07 22:22:52.467: e/androidruntime(10785):    @ com.badlogic.gdx.graphics.pixmap.<init>(pixmap.java:137) 07-07 22:22:52.467: e/androidruntime(10785):    ... 13 more 07-07 22:22:52.467: e/androidruntime(10785): caused by: java.io.filenotfoundexception: /data/data/com.iliadonline.client/files/data/gfx/fonts/default.png 07-07 22:22:52.467: e/androidruntime(10785):    @ android.content.res.assetmanager.openasset(native method) 07-07 22:22:52.467: e/androidruntime(10785):    @ android.content.res.assetmanager.open(assetmanager.java:315) 07-07 22:22:52.467: e/androidruntime(10785):    @ android.content.res.assetmanager.open(assetmanager.java:289) 07-07 22:22:52.467: e/androidruntime(10785):    @ com.badlogic.gdx.backends.android.androidfilehandle.read(androidfilehandle.java:72) 07-07 22:22:52.467: e/androidruntime(10785):    ... 15 more 

file permissions

i have checked files exist , have right owner/group , set permissions 777 test.

shell screen shot

i've seen several other questions problem assets folder in projects, i'm not using assets folder. , code able find .fnt file sitting next .png.


font definition header

info face="droid sans" size=17 bold=0 italic=0 charset="" unicode=0 stretchh=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 common lineheight=20 base=18 scalew=256 scaleh=128 pages=1 packed=0 page id=0 file="default.png" chars count=95


in case helps, here code use file handles:

filehandle datadir = gdx.files.local("data");  filehandle gfxdir = datadir.child("gfx"); if(!gfxdir.isdirectory()) {     //mkdirs make directories, includes "data" dir     gfxdir.mkdirs(); }  filehandle spritesdir = gfxdir.child("sprites"); if(!spritesdir.isdirectory()) {     spritesdir.mkdirs(); }  filehandle fontsdir = gfxdir.child("fonts"); if(!fontsdir.isdirectory()) {     fontsdir.mkdirs(); } 

p.s. font file , png worked when in assets folder. i'm assuming setup properly.

you're running filenotfound exception android.content.res.assetmanager.open, doc explicitly states only works "files bundled assets".

however, don't call directly....

ah, libgdx bitmapfont constructor uses gdx.files.internal load font texture:

public bitmapfont (bitmapfontdata data, textureregion region, boolean integer) {         this.region = region == null ? new textureregion(new texture(gdx.files.internal(data.imagepath), false)) : region;         ... 

(that seems might bug in libgdx assume font texture file "internal", i'm not sure how should work around ...)

i think can work around invoking the bitmapfont constructor takes explicit texture file in loadfonts method.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -