[SOLVED] Cannot load audio files from classpath.Place your audio files in Android's assets directory


My android game hangs on startup. I already had a background audio but it was in WAV. Now i converted the file to OGG vorbis and imported jogg. Everything runs fine in x86,but the application won’t start and i’ve not found any thread related to this exact issue on the forum. Is this a bug on the loader or should i load audio nodes differently on android? How can i put the audio files in “Android’s assets directory” as the error tells?

However,there’s the code i use to load the audio file,hope it helps solving the doubt:

this.aM=app.getAssetManager(); audioNode=new AudioNode(aM,"sounds/soundtrack.ogg",true); audioNode.setLooping(true); audioNode.setPositional(false); audioNode.setVolume(.5f);

Kind of funny as the SDK Android deployment should actually place the assets in androids assets directory…

I use the latest version of SDK but i had to build a gradle project for my android applications as SDK’s android deployment is really outdated as it still uses ant. Is there a way i can implement those assets’ placement with gradle?

Idk, read up on the Android Gradle deployment, I’m sure they have documentation.

I have to specify that the WAV file was loaded normally. This issue showed when i switched to the OGG format.

You said that but we can’t offer support on all deployment/build systems people might use. If you chose to use your own build system you’ll have to resort to the corresponding documentation.

Solved. I had to use some hacky tricks but now my build file copies assets into android’s assets directory (‘src/main/assets’ ,located in your app’s project) and ignores other assets.