Open In App

How to Add Audio Files to Android App in Android Studio?

Last Updated : 18 Feb, 2021
Like Article

The audio file format is a file format for saving digital audio data on a computer system and all are aware of audio files. So in this article, we are going to discuss how can we add audio files to the android app. There are three major groups of audio file formats:

Format Name



Uncompressed audio formats Uncompressed audio formats are also known as raw audio format. RAW Audio format or just RAW Audio is an audio file format for saving uncompressed audio in raw form. Comparable to WAV or AIFF in size, the RAW Audio file does not include any header information. WAV (Waveform Audio File Format), AIFF (Audio Interchange File Format), etc.
Formats with lossless compression A lossless compressed audio format saves data in a smaller space without wasting any information. The original, uncompressed data can be recreated from the compressed version. FLAC, Monkey’s Audio WavePack, TTA
Formats with lossy compression The lossy audio format allows even greater reductions in file size by eliminating some of the audio information and simplifying the data. Opus, MP3, Vorbis, Musepack, AAC, ATRAC

Note: Android supports the following audio format

  • MP3
  • MIDI
  • Opus
  • Vorbis
  • FLAC
  • AMR-WB
  • AMR-NB etc.

Step by Step Implementation

Step 1: Open your android studio go to the app > res > right-click > New > Android Resource Directory as shown in the below image. 

Step 2: Then a pop-up screen will arise like below. Here in Resource type choose raw.

Step 3: After choosing the raw from the dropdown menu click on the OK button and keep all the things as it is.

Step 4: Now you can see the raw folder has been created and you can find the folded in the app > res > raw as shown in the below image. 

Step 5: After creating the raw folder successfully go to your own system and copy the required audio files as we do normally. Now again come back to the android studio and right-click on the raw folder. Then click on the Paste button as shown in the below image.

Step 6: Here on this screen you can rename your audio file name as your requirement. And click on the Refactor button. And you are done.

Now go to the app > res > raw and you can find your audio file as shown in the below figure.

Now open the Java File of the desired activity, here we are adding audio in the file and add this following code in the file.


MediaPlayer music = MediaPlayer.create(MainActivity.this,;

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads