"File not found" when running new LibGDX project

For those of us using Android Studio or IntelliJ IDEA, you need to follow these steps:

  1. Select Run -> Edit Configurations from the menu

  2. In the "Working Directory:" text box, append "/android/assets" to the path.

Note that if you execute tasks with gradle, this is not an issue. The gradle.build files are configured to use the assets folder from the android module.


For those using Intellij IDEA:

  1. Run -> Edit Configurations
  2. On the left hand side choose: Application -> DesktopLauncher
  3. In the "Configuration"-Tab, undert "Working directory" choose your android/assets path

From libgdx wiki

When you run Desktop Project

The application will fail the first time. Open the Run Configuration you just created and set the working directory to the android/assets/ directory!

link your desktop project to android assets folder?

Go to Run => Run Configurations.. => choose DesktopLauncher, Arguments Tab => Working Directory => Others then browse to yourproject-android/assets/ and click Apply => Run

enter image description here


Note that the previous answers will not work for users who unchecked the "Android" box on setup. There should really be a default assets folder installed for those who don't care about deploying for Android.

Tags:

Java

Libgdx