How To Add Audio To App In Android Studio

Adding audio clip to android application is a simple task as it also add some further functionality. Here is a step by step on how to play music when App will start.

Adding Audio to app in Android Studio:

Step 1: Open the android studio with the project in which you want to add-on audio clip/media file.
Step 2: Create a raw folder.
Step 3: Add media file to raw folder by simply copy and paste that to raw folder.
Step 4: Here we added a media file “ring.mp3” . Now open the Java File of desired activity, here we are adding audio in MainActivity.
Step 5: Further add this code

MediaPlayer ring= MediaPlayer.create(MainActivity.this,R.raw.ring);

Step 6: Now run the App and your music will play when App will start.

With a very poor revenue from selling source code files or using Google AdSense, we need your help to survive this website. Please contribute any amount you can afford
* Terms & Conditions Apply

21 thoughts on “How To Add Audio To App In Android Studio”

  1. MediaPlayer sing= MediaPlayer.create(MainActivity.this,R.raw.ring);
    raw cannot resolve

  2. Hello, I need to add additional options for sounds to my project. I’m using the android-Repeating Alarm from I’m just not sure how to go about it.


  3. Hi,pls i need your help.i created a setting activity where i have a switch which i intend to control my app background sound/music ,but i cant get the switch to control my sound.

  4. Hi, I did exactly what is written here but android studio says : it cannot resolve the work START which you have written on the second line : ring.start();

    1. You have to put all of this in a function. And that function I’ve put on a ‘onClick’-event. It works just fine!
      But i would like to play it when the activity starts. That’s my next step.

  5. I already add raw folder to my project with audio but when I build the program it shows error that cannot find symbol variable raw please help me