Sound file not found

E/AndroidAudioRenderer(16267): Sounds/page-flip.wav
E/AndroidAudioRenderer(16267): at android.content.res.AssetManager.openAssetFd(Native Method)
E/AndroidAudioRenderer(16267): at android.content.res.AssetManager.openFd(
E/AndroidAudioRenderer(16267): at
E/AndroidAudioRenderer(16267): at
E/AndroidAudioRenderer(16267): at v3l.client.scene.ReadingScene.flipForward(
E/AndroidAudioRenderer(16267): at v3l.client.scene.ReadingScene.onTouch(
E/AndroidAudioRenderer(16267): at com.jme3.input.InputManager.onTouchEventQueued(
E/AndroidAudioRenderer(16267): at com.jme3.input.InputManager.processQueue(
E/AndroidAudioRenderer(16267): at com.jme3.input.InputManager.update(
E/AndroidAudioRenderer(16267): at
E/AndroidAudioRenderer(16267): at
E/AndroidAudioRenderer(16267): at
E/AndroidAudioRenderer(16267): at
E/AndroidAudioRenderer(16267): at android.opengl.GLSurfaceView$GLThread.guardedRun(
E/AndroidAudioRenderer(16267): at android.opengl.GLSurfaceView$
I/com.jme3.scene.Node(16267): INFO Node 9:53:01 PM Child (BitmapFont) attached to this node (null)

Hello Jmonkey, I currently try to play a sound in Android Application that created by Jmonkey. It work fine on PC , however, it show above error when running on android, which I sure that the sound file is already in asset.jar

What happend???

Thanks you in advance

Oop, sorry I just see

which is the same problem as me except my file is wav file.

The problem still cannot be solved

The path is case sensitive

l quite sure that the path is correct. the sound can be play in pc but not in Android. l still dont know why:-(

The audio files needs to be in the android asset folder in order to be opened by openFd.

You can copy them by hand, but this is ugly because you’ll have them twice.

You can make the asset-build to copy the jme assets in the appropriate folder.

1 Like

Sorry, I don’t understand. There are audio files in asset.jar in Mobile project. However, what do you mean “android asset folder”? do I have to create one on my own ?

Thank you :slight_smile:

Ah. No, there is a bug where audio files cannot be played from a jar file on android.

Wow, thank you. It’s exactly as you said. My problem is already solved :slight_smile:

Hi folks I just spent some time trouble shooting this issue aswell (Initially I tried putting the files in raw, and raw/Sounds

no go

after googling around I found this ‘reference from android dev guide’

Arbitrary files to save in their raw form. To open these resources with a raw InputStream, call Resources.openRawResource() with the resource ID, which is R.raw.filename.

However, if you need access to original file names and file hierarchy, you might consider saving some resources in the assets/ directory (instead of res/raw/). Files in assets/ are not given a resource ID, so you can read them only using AssetManager.

(where the assets folder is parallel to the /res folder.

In summary:

(raw != assets folder)

You will need to create a new folder parallel to the /res folder called assets, then copy/move your sound files into assets so end up with: assets/Sounds/).



Thanks danomano, your answer has shown me the path to the light!!

Now I can play sounds on android. Yeah!

What I did is to copy (by hand) the sound carpet from the typical jMonkey asset folder to a new folder created inside the mobile folder called asset.

Then with this code:


sonidoAmbiente= new AudioNode(assetManager, "Sounds/loop.ogg", true);





I can play the sound!!!