简体   繁体   中英

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!

它不应该在projectname / res / raw中,而不是projectname / raw吗?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM