Android原始资源文件不可读

Android原始资源文件不可读,android,file-permissions,android-2.2-froyo,Android,File Permissions,Android 2.2 Froyo,我已经把几个mp3文件作为原始资源添加到我的项目中。我想用AudioPlayer播放它们。我有FileNotfoundException,我回溯发现可以找到这些文件,但它们不可读: mp1.stop(); mp1.reset() 我无法调用file.setReadable(),因为我使用API级别7 我的舱单: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas

我已经把几个mp3文件作为原始资源添加到我的项目中。我想用AudioPlayer播放它们。我有FileNotfoundException,我回溯发现可以找到这些文件,但它们不可读: mp1.stop(); mp1.reset()

我无法调用file.setReadable(),因为我使用API级别7

我的舱单:

   <?xml version="1.0" encoding="utf-8"?>
   <manifest xmlns:android="http://schemas.android.com/apk/res/android"
       package="com.example.movingcircle"
       android:versionCode="1"
       android:versionName="1.0" >

       <uses-sdk
           android:minSdkVersion="8"
           android:targetSdkVersion="8" />

       <application
           android:allowBackup="true"
           android:icon="@drawable/ic_launcher"
           android:label="@string/app_name"
           android:theme="@style/AppTheme" >
           <activity
               android:name="com.example.movingcircle.MovingCircle"
               android:label="@string/app_name" >
               <intent-filter>
                   <action android:name="android.intent.action.MAIN" />

                   <category android:name="android.intent.category.LAUNCHER" />
               </intent-filter>
           </activity>
       </application>

   </manifest>

试试看


你想玩mp3吗?我想问题不在于mp3的播放。我可以在另一个应用程序中使用此代码播放mp3。在这种特殊情况下,我发现mp3不可读。
getResources().getString(playedSound)从strings.xml返回字符串,而不是从rawNo返回文件的路径,它不返回。它返回“res/raw/sip02.mp3”,我以前已经创建了mediaplayer。实际上,我希望它能播放一种与以前不同的声音。我假设您只能调用mPlayer.create()一次。@user1105818
   <?xml version="1.0" encoding="utf-8"?>
   <manifest xmlns:android="http://schemas.android.com/apk/res/android"
       package="com.example.movingcircle"
       android:versionCode="1"
       android:versionName="1.0" >

       <uses-sdk
           android:minSdkVersion="8"
           android:targetSdkVersion="8" />

       <application
           android:allowBackup="true"
           android:icon="@drawable/ic_launcher"
           android:label="@string/app_name"
           android:theme="@style/AppTheme" >
           <activity
               android:name="com.example.movingcircle.MovingCircle"
               android:label="@string/app_name" >
               <intent-filter>
                   <action android:name="android.intent.action.MAIN" />

                   <category android:name="android.intent.category.LAUNCHER" />
               </intent-filter>
           </activity>
       </application>

   </manifest>
  MediaPlayer mPlayer = MediaPlayer.create(PlayWorld.this, R.raw.your_mp3);