android - File not found: data\image.png (Internal) -


@override public void create() {             batch = new spritebatch();     texture = new texture(gdx.files.internal("data/image.png"));     sprite = new sprite(texture); } 

heres main code it. believe have linked android , desktop assets folder still give me error. must have done wrong don't know what. image located in c:\users\dakota pederson\desktop\slingshot steve\android\assets

below full error:

exception in thread "lwjgl application" com.badlogic.gdx.utils.gdxruntimeexception: couldn't         load file: data/image.png @ com.badlogic.gdx.graphics.pixmap.<init>(pixmap.java:140) @ com.badlogic.gdx.graphics.glutils.filetexturedata.prepare(filetexturedata.java:64) @ com.badlogic.gdx.graphics.texture.load(texture.java:130) @ com.badlogic.gdx.graphics.texture.<init>(texture.java:121) @ com.badlogic.gdx.graphics.texture.<init>(texture.java:100) @ com.badlogic.gdx.graphics.texture.<init>(texture.java:92) @ com.dakotapederson.slingshotsteve.slingshotsteve.create(slingshotsteve.java:18) @ com.badlogic.gdx.backends.lwjgl.lwjglapplication.mainloop(lwjglapplication.java:136) @ com.badlogic.gdx.backends.lwjgl.lwjglapplication$1.run(lwjglapplication.java:114) caused by: com.badlogic.gdx.utils.gdxruntimeexception: file not found: data\image.png (internal) @ com.badlogic.gdx.files.filehandle.read(filehandle.java:136) @ com.badlogic.gdx.files.filehandle.readbytes(filehandle.java:220) @ com.badlogic.gdx.graphics.pixmap.<init>(pixmap.java:137) ... 8 more 

try gdx.files.local() load file, instead of gdx.files.internal(), "internal" files read out of (compressed) apk , may not "visible" normal file. (this depends lot on code you're passing pathname wants it.)

for libgdx filehandle file object use file.file() pass file handle, instead of file.path() pass string might misinterpreted.

for libgdx filehandle file use file.read() pass inputstream directly consumer (instead of passing string or file handle , expecting them open it).

a libgdx "internal" file maps android assetmanager file, can bit wonky in some cases. specifically, may compressed , stored within .jar or .apk , not visible traditional file reading functions.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -