0
votes

So i am creating a little game with libgdx.

So i thought that i would go ahead and test it to make sure the scaling and everything in the game works the way it should work.

When i have everything setup and i run the "Android Application" i loads for a few seconds, i see something open on my phone but then it crashes and here is the LogCat log:

E Problems @ Javadoc 4, Declaration Console ts. Debug al LogCat El Saved Filters 119 All messages (no filters) (9414) 'Search for messages. Accepts Java regexes. Prefix with pid:, app:, tag: or tat to limit scope. contheavenappsjurnpdodgeandmid(Sessi L. Time PID PID TID Application Tag W 05-16 19:07:1... 26671 26707 com.heavenapps.... dalvikvm E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... E 05-16 19:07:1... 26671 26707 com.heavenapps.... AndroidRun... Text threadid=11: thread exiting with uncaught exception (group=0x40e144 38) FATAL EXCEPTION: GLThread 10388 com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: Spl = ash Screen/Background.png at com.badlogic.gdx.graphics.Pixmap.(Pixmap.java:140) at com.badlogic.gdx.graphics.TextureDataSFactory.loadFromFile(Text = ureData.java:98) at com.badlogic.gdx.graphics.GLIexture.createTextureData(GLIexture e .java:185) at com.badlogic.gdx.graphics.Texture.(Texture.java:103) at com.badlogic.gdx.graphics.Texture.(Texture.java:95) at com.heavenapps.jumpdodge.handlers.Assets.init(Assets.java:35) at com.heavenapps.jumpdodge.JumpDodge.create(JumpDodge.java:15) at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChan = ged(AndroidGraphics.java:241) at android.opengl.GLSurfaceView;GLThread.guardedRun(GLSurfaceView. java:1505) at android.opengl.GLSurfaceView4GLIhread.run(GLSurfaceView.java:12 40) Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error readin e g file: Splash Screen/Background.png (Internal) at com.badlogic.gdx.backends.android.AndroidFileHandle.read(Androi 0 dFileHandle.java:77) at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:222 0 at com.badlogic.gdx.graphics.Pixmap.(Pixmap.java:137) ... 9 more Caused by: java.io.FileNotFoundException: Splash Screen/Background. € png at android.content.res.AssetManager.openAsset(Native Method) at android.content.res.AssetManager.open(AssetManager.java:315) at android.content.res.AssetManager.open(AssetManager.java:289)

(cannot post images :/)

Now my question to you is:

Why does this happen?

How can i fix it?

Thank you! :)

1
FileNotFoundException, Splash Screen/Background. € png doesnt exist, go through your code when you try to load the texture and make sure it is referencing a file that exists - JRowan
@JRowan Yeah but when i run the program on the desktop version it works fine. - Adam Brodin
is Screen/Background.png in your Assets folder? - JRowan
@JRowan Yup, which is in my Game-Core folder - Adam Brodin

1 Answers

0
votes

Your assets folder needs to be in the android project, not the core-project. So just move all your assets to the /assets folder inside the android project and in your desktop-project there should be this assets as a linked folder. If the assets folder isn't inside the android project then Android is not able to find those, it is not enough to put those assets in the core-project!

See also the libgdx setup guide here

You can see the assets folder in the default android project structure:

android/
build.gradle           <- Gradle build file for android project*
AndroidManifest.xml    <- Android specific config
assets/                <- contains for your graphics, audio, etc.  Shared with other projects.
res/                   <- contains icons for your app and other resources
src/                   <- Source folder for your Android project, contains android launcher class