title: Android 4.2 sdk - Nexus 7 - mp4 in res/raw - No such file - Can't play video
body: <p>I can not seem to get video playing on my device (Nexus 7).  I decided to just start fresh with a new project for this problem.</p>
  
  <p>The video is stored in res/raw.<br>
  It is this video: <a href="http://www.howtodance.org/media/Lesson_2__9_lindy_demo_2__shoulder_pop_with_scoop_around.mp4" rel="nofollow">http://www.howtodance.org/media/Lesson_2__9_lindy_demo_2__shoulder_pop_with_scoop_around.mp4</a></p>
  
  <p>I have tried many of the ways suggested here at stackoverflow.  Here is the latest of what I have tried:</p>
  
  <pre><code>    &lt;!-- main.xml --&gt;
  
  
      &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                    android:orientation="vertical"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
              &gt;
          &lt;Button
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="New Button"
                  android:id="@+id/button"
                  android:layout_gravity="center"
                  android:onClick="onButtonClick"
                  /&gt;
  
      &lt;/LinearLayout&gt;
  </code></pre>
  
  <hr>
  
  <pre><code>//MyActivity.java
  
  package com.example.VideoTests;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.net.Uri;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.View;
  
  import java.io.File;
  
  public class MyActivity extends Activity {
      /**
       * Called when the activity is first created.
       */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
      }
  
  
  
      public void onButtonClick(View v){
          Log.d("working", "PlayVideo();");
          //  both of these urls don't seem to work
          //String uriString = "android.resource://com.example.VideoTests/raw/lesson_2__9_lindy_demo_2__shoulder_pop_with_scoop_around.mp4";
          String uriString = "android.resource://" + getPackageName() + "/" + R.raw.lesson_2__9_lindy_demo_2__shoulder_pop_with_scoop_around;
  
          //Uri video = Uri.parse(uriString);
          File file = new File(uriString); // video player selection dialog doesn't seem to load at all unless I send it through a file first.
          Intent intent = new Intent(Intent.ACTION_VIEW);
          intent.setDataAndType(Uri.fromFile(file), "video/mp4");
          startActivity(intent); // this is where it seems to crash
      }
  
  }
  </code></pre>
  
  <p>After adding the File object a dialog finally comes up, but then I get a message saying "Can't play this video" and the following error:</p>
  
  <pre><code>ERROR/(128): Failed to open file '/android.resource:/com.example.VideoTests/2130968576'. (No such file or directory)
  </code></pre>
  
  <p>If I use the other uriString, it still gives me this error:</p>
  
  <pre><code>ERROR/(128): Failed to open file '/android.resource:/com.example.VideoTests/raw/lesson_2__9_lindy_demo_2__shoulder_pop_with_scoop_around.mp4'. (No such file or directory)
  </code></pre>
  
  <p>I have also tried changing the video file name to something short like 'asdf.mp4', but the same errors occur</p>
  
  <p>Thank you in advance for any help everyone.</p>