[英]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.我的问题是我想创建一个 MediaPlayer 来播放我放置在项目res
文件夹内的raw
文件夹中的声音。 But when I do但是当我这样做时
example = MediaPlayer.create(this, R.raw.myfile)
it doesn't locate the R.raw*
path.它没有找到R.raw*
路径。
I can solve this by importing android.R
in my class, but now it won't locate my classes.我可以通过在我的 class 中导入android.R
来解决这个问题,但现在它不会找到我的课程。
This is when I try without importing android.R
这是我尝试不导入android.R
And this when I import android.R
当我导入android.R
Also it won't locate my file inside the raw
folder either way.此外,无论哪种方式,它都不会在raw
文件夹中找到我的文件。
Pls help I can't get it to work:c请帮助我无法正常工作:c
Try rebuilding your project.尝试重建您的项目。
To do that you can go on the Build > Rebuild Project.为此,您可以在 Build > Rebuild Project 上 go。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.