Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

raw cannot be resolved or is not a field error (Eclipse/Android/Java)

For some odd reason I'm getting this error: raw cannot be resolved or is not a field

I'm trying to do the following

   MediaPlayer click = MediaPlayer.create(this, R.raw.button_click.mp3);

in my onCreate method.

I've checked the folder & mp3 file, and it's <project-name>/raw/button_click.mp3. I've tried:

  • Cleaning up my project
  • Restarting Eclipse
  • Making it R.raw.button_click
  • Checking if everything's lowercased & spelled correctly

Help, please!

like image 429
Alex Avatar asked Dec 22 '22 07:12

Alex


1 Answers

Shouldn't it be in projectname/res/raw, instead of projectname/raw?

like image 182
Chad Schultz Avatar answered Dec 28 '22 10:12

Chad Schultz