user3579269
user3579269

Reputation: 23

Android Studio with libGdx(Java) - Music work on android emulator but not on desktop

Here's my code:

music = Gdx.audio.newMusic(Gdx.files.internal("music.mp3"));
music.setLooping(true);
music.setVolume(0.1f);
music.play();

When i run the app on android emulator everything work as it should and when i run the app on desktop there's no music. What should i do?

Upvotes: 0

Views: 82

Answers (1)

user3579269
user3579269

Reputation: 23

After another searching, I finally found an answer! this happens because I have on my computer an username that isn't in english. All i needed to do was to add System.setProperty("user.name","seconduser"); to the DesktopLauncher code. The final code should look like this:

public class DesktopLauncher {
public static void main (String[] arg) {
    System.setProperty("user.name","seconduser");
    LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
    new LwjglApplication(new GameName(), config);
}

Hope it will help someone else.

Upvotes: 1

Related Questions