简体   繁体   English

如何正确创建“原始”文件夹(/ res / raw)以便播放放入其中的音频文件

[英]How to create correctly the “raw” folder(/res/raw) in order to play audio file puted in it

When I create a new project the "raw" folder does not appear automaticaly and I have to do it manually. 当我创建一个新项目时,“ raw”文件夹不会自动出现,我必须手动执行。 The problem is that after creation of this folder and when I already copied the audio file in it I can't define it, as it's happens in tutorials, using R.raw.audio.mp3(also in R.java there is no declaration about raw folder). 问题是创建此文件夹后,当我已经在其中复制了音频文件时,由于在教程中使用R.raw.audio.mp3(在R.java中也没有声明),因此无法对其进行定义关于原始文件夹)。 The line of code with error is MediaPlayer playMyMusic = new MediaPlayer().create(MainActivity.this, R.raw.Song); 有错误的代码行是MediaPlayer playMyMusic = new MediaPlayer()。create(MainActivity.this,R.raw.Song); and the error apears at raw (error: "raw cannot be resolved or is not a field") Must to note that I'm new in android development and sorry for bad English. 并且原始错误会出现(错误:“原始无法解析或不是字段”)必须注意,我是android开发的新手,并且对英语不好感到抱歉。

右键单击“ res”文件夹“新建目录”,名称为“ raw”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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