Libgdx - Gdx.files.internal (); & # 8594; File not found

I'm having trouble using Gdx.files.internal () from libgdx; It seems that every time I run it as a desktop application, I get this main error:

Called: com.badlogic.gdx.utils.GdxRuntimeException: File not found: \ data \ sounds \ music \ mainmusic.mp3 (Internal) in com.badlogic.gdx.files.FileHandle.read (FileHandle.java:136) in com .badlogic.gdx.backends.lwjgl.audio.Mp3 $ Music. (Mp3.java:42) ... 10 more

I read 5 separate threads in this question, one of which seemed to be the most likely problem, so I tried ...

  • creation of an asset data folder
  • Eclipse browser update
  • Project> Clean
  • manually creating a data / data folder in the recycle bin (in the kernel)
  • triple file verification paths
  • reboot IDE

my full path to / Flipcrew Legends-desktop / assets / data / sounds / music / mainmusic.mp3

The public class SplashScreen implements the screen {

final FlipcrewLegends game; Texture splashTexture; Sprite splashSprite; SpriteBatch batch; TweenManager manager; Music introMusic; public SplashScreen(FlipcrewLegends game) { this.game = game; introMusic = Gdx.audio.newMusic(Gdx.files.internal("data/sounds/music/mainmusic.mp3")); introMusic.setLooping(true); } 

This, however ... seems to work ..

 @Override public void show() { splashTexture = new Texture("data/images/main/splash.png"); splashTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); splashSprite = new Sprite(splashTexture); splashSprite.setColor(1, 1, 1, 0); } 

path: / Flipcrew Legends-desktop / assets / data / images / main / splash.png

// The rest of the class is omitted b / c, it does not seem necessary (I can add it if necessary)

// unfortunately, Gdx.audio.newMusic does not seem to have a direct line method, so I could not try this.

Additional information: -> I tried to copy the resource folder to the desktop folder from the kernel without the possibility (deleted after) -> One thread said that libgdx usually takes data from the android folder and then applies it to the desktop (unfortunately, I started working only with a desktop computer, without android), but I assume that libgdx has been updated since the last post, maybe an alternative was added for this?

edit:

  • Only now after the return of assets / data / etc .... to assets / etc ..... even new Texture(path); gets the same error - it still doesn’t work ... repeated the above methods, will restart the computer after publication, it may be a compilation problem.

  • rebooted computer, no difference

+6
source share
2 answers

Try to β€œclean” your project by going to Project-> Clean. Also try updating the libGDX desktop folder by right-clicking and using Gradle -> Update All

libGDX uses linked folders. You just need to copy the file to one of your resource folders (do it in eclipse, not in the file explorer.)

+5
source

What worked for me, I had to go into assets β†’ Build path β†’ Configure inclusion / exclusion. I had to add all the necessary folders and files to the "Inclusion" section.

+2
source

Source: https://habr.com/ru/post/971715/


All Articles