Problem playing audio on android

by Alex Coventry » Mon, 22 Feb 2010 15:03:30 GMT

Sponsored Links
 The following code crashes when I try to play it on my droid. The
error message given in the log is "Command PLAYER_INIT completed with
an error or info PVMFErrNoResources."  Then an IOExecption is raised.
There is a file "res/raw/bell.mp3" in my project directory, which I
assume corresponds to R.raw.bell in the code below. I am building with
"ant debug". In case it's relevant, when I created the project
directory with "android create", I set the target number to 4,
corresponding in my system to "android 2.0."

What am I doing wrong, here?

import android.os.Bundle;
import android.util.Log;

public class testapp extends Activity
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState)
 try {
     MediaPlayer mp = MediaPlayer.create(this, R.raw.bell);
 } catch (IOException e) {
     Log.v(getString(R.string.app_name), e.getMessage());



Problem playing audio on android

by OldSkoolMark » Mon, 22 Feb 2010 22:34:06 GMT

 Try putting the start() call in onResume().


Sponsored Links

Problem playing audio on android

by Alex Coventry » Tue, 23 Feb 2010 23:25:02 GMT

 OldSkoolMark <mark <at>> writes:

Thanks for the suggestion.  Turned out the mp3 file I was testing with is
unplayable on android.  Transcoding with ogg and replacing fixed the problem. 
On the other hand, no other android apps were able to play the file.  The file
was generated from a WAV using LAME, and is playable with mplayer.)


Other Threads

1. Need to know RPC design in android

Hello all,
I am very new to the android world. I am concerned about the kernel
level code in android.
I am currently looking for document on RPC(Remote procedure Call) in
android. It seems like android uses SunRPC. But I do not find any
document related to RPC.
Can any please help in finding a decent document which briefs the RPC
design in android?

Looking forward to your replies


2. How to build android source code and SDK correctly by cygwin?

Hi all:

    The code was downloaded successfully by cygwin. But when I make
it, the errors were as follows:
build/core/ sdk-only: javac available.
make: *** No rule to make target `/usr/lib/tools.jar', needed by `out/
mon/docs/offline-sdk-timestamp'.  Stop.

    I can make the NDK successfully by cygwin and my tool chains are
listed in the
1. gcc version 3.4.4
2. GNU Make 3.81
3. java version "1.6.0_16

Dose anyone help me?
Thanks a lot!!



3. Where have all the Google employees gone?

4. Can android applications install it's shared library files(*.so) from own update server?

5. Archos 5 Android PMP

6. Remote Wipe /Hard Reset / Factory Default

7. The application android has stopped unexpectedly