thrivegeek
thrivegeek

Reputation: 1

Can't access audio in the raw folder

I'm learning to program Android thru cornboyz on youtube and he wants me to play a sound on the splash screen but when I do "R.raw" it won't recognized raw.

The error says "Multiple markers at this line - raw cannot be resolved or is not a field - R cannot be resolved to a variable"

Upvotes: 0

Views: 3391

Answers (3)

Bill Gary
Bill Gary

Reputation: 3005

Remove the capital letter in the sound files name.

Upvotes: 0

strongmayer
strongmayer

Reputation: 488

First of all be sure that you have a "raw" folder in the res folder. If you have that folder and you have a file in it, you can access it by R.raw.file_name. It may happen that you already imported the android.R class in your class. In this case you cannot access the R class of your project by R.raw for example. You have to use your_project_package.R.raw if you have this problem.

Upvotes: 4

slayton
slayton

Reputation: 20319

R.java is an automatically generated for you. If it cannot be found that means that R isn't getting generated. First try cleaning your project. If that doesn't fix the problem something in your res/ folder is probably screwed up, possibly one of your XML files.

Upvotes: 1

Related Questions