简体   繁体   中英

Can't locate my raw folder (Android Studio)

First of all, I'm a noob, I just started coding and I don't know much about it.

My problem is that I want to create a MediaPlayer that plays a sound I've placed in a raw folder inside the res folder in my project. But when I do

example = MediaPlayer.create(this, R.raw.myfile)

it doesn't locate the R.raw* path.

I can solve this by importing android.R in my class, but now it won't locate my classes.

This is when I try without importing android.R

And this when I import android.R

Also it won't locate my file inside the raw folder either way.

Pls help I can't get it to work:c

Try rebuilding your project.

To do that you can go on the Build > Rebuild Project.

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