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.

  • Is this article helps you understand ?
  • Yes   No

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

  1. 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