title: Media Player File not found exception
body: <p>I'm writing a basic android mp3 player app that uses the MediaPlayer app to play an mp3 file stored locally on an Android phone. </p>
  
  <p>However, whenever I try calling <code>MediaPlayer.create()</code> i get a <code>java.io.FileNotFoundException</code>. </p>
  
  <p>I've checked to make sure that the mp3 is in the correct path and I've tried running this on both an emulated Android and my own phone but I keep getting the same error. </p>
  
  <p>Here's my onCreate function where I'm having the problem:</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState)
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath() + 
         "/Download/sam_stone.mp3");
  
      med = MediaPlayer.create(getApplicationContext(), uri);
  }
  </code></pre>
  
  <p>Here's the error I'm getting:</p>
  
  <blockquote>
    <p>java.io.FileNotFoundException:
    /storage/emulated/0/Download/sam_stone.mp3 (Permission denied)
                   at java.io.FileInputStream.open(Native Method)
                   at java.io.FileInputStream.(FileInputStream.java:146)
                   at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1088)
                   at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1067)
                   at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1009)
                   at android.media.MediaPlayer.setDataSource(MediaPlayer.java:967)
                   at android.media.MediaPlayer.create(MediaPlayer.java:874)
                   at android.media.MediaPlayer.create(MediaPlayer.java:851)
                   at android.media.MediaPlayer.create(MediaPlayer.java:830)
                   at hn.mediaplayer.MainActivity.onCreate(MainActivity.java:48)
                   at android.app.Activity.performCreate(Activity.java:6662)
                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
                   at android.app.ActivityThread.-wrap12(ActivityThread.java)
                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
                   at android.os.Handler.dispatchMessage(Handler.java:102)
                   at android.os.Looper.loop(Looper.java:154)
                   at android.app.ActivityThread.main(ActivityThread.java:6077)
                   at java.lang.reflect.Method.invoke(Native Method)
                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)</p>
  </blockquote>