I'm having a problem playing sounds on Android. I've added the following code to my project:
import playn.core.Sound;
...
@Override
public void init() {
Sound bg = assets().getSound("bg");
bg.play();
...
}
The code works as intended when I run mvn test -Pjava
. The sound plays without a problem. However, when I run mvn -Pandroid install
the sound doesn't play. I don't get any errors in logcat or anything, the game is just silent.
I've tried:
- Using different sound formats (wav, mp3)
- Loading a sound file that isn't in the assets folder - in this case I get an error notifying me that the sound file was not found. But I get no such error when loading an actual sound file
- Using different mvn versions
- Made sure the device is not set to silent
- Using multiple devices (Nexus 7, older Android phone)
- Reproducing this issue in the Showcase example (it's the same as in my project)
- Upgrading PlayN from 1.7 to 1.7.2, no change.
I've found that running mvn install
instead of mvn test -Pjava
loads up the desktop version without sound as well. This makes me think there might be an issue with the install command, but I'm just guessing here.
Any ideas on how to make sound work on Android?