Reputation: 261
I created a libgdx project for android desktop HTML and iOS with the libgdx gradle setup then i imported it in eclipse. I tried to run the desktop application with no changes and this is what eclipse outputs.
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: badlogic.jpg
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:140)
at com.badlogic.gdx.graphics.glutils.FileTextureData.prepare(FileTextureData.java:64)
at com.badlogic.gdx.graphics.Texture.load(Texture.java:130)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:121)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:100)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:92)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:88)
at si.borenovic.igor.samplegame.SampleGameMain.create(SampleGameMain.java:16)
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: File not found: badlogic.jpg (Internal)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136)
at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:220)
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:137)
... 9 more
Upvotes: 2
Views: 3607
Reputation: 1
If you are using Eclipse and you, upon import, select the "COPY EXISTING PROJECTS INTO WORKSPACE" option, you are creating a new copy of the projects under a new path.
The project files don't update the references to those paths... so you either need to update the reference manually (see above) or do not copy into the workspace, pointing to the original gdx-setup generated project location.
Upvotes: 0
Reputation: 785
This is because libgdx doesn't find the image file "badlogic.jpg". To do this you shoud add a link in your desktop application from the assets folder in the Android app.
In this link it is explained better how to do it:
http://www.badlogicgames.com/wordpress/?p=1537
Upvotes: 1