3

I'm walking through a small example to hit https web services. It requires building a keystore and placing the resulting bks file into the /res/raw directory. Simple enough. However, I can not access the file through R.raw...

I placed the file into the /res/raw directory, refreshed my project in Eclipse, navigated to the /res/raw directory in Eclipse and confirmed that it showed up in the project. However, when I type R.raw. in my file, the resulting list of possible filenames is empty.

I've tried cleaning and rebuilding, but the project still has no clue what R.raw.mycert is.

What am I doing wrong?

Andrew
  • 20,756
  • 32
  • 99
  • 177

3 Answers3

1

The answer to this question can be found here:

R.raw.anything cannot be resolved

Community
  • 1
  • 1
Andrew
  • 20,756
  • 32
  • 99
  • 177
  • Solution of change package import did not solve my problem still. What is the correct way to add mp3 files into a raw directory? It worked with a midi file in an earlier project, but not this copy? – Chucky Feb 06 '13 at 16:53
0

Try this -- find your EclipseWorkspace. There should be a 'res' directory. So open it. You will likely NOT find a 'raw' subdirectory.
So create a 'raw' directory, and drop your file into it. (I suppose these have to follow the rwx permissions under Linux that the others follow. I did this in Windows.) Close the project, then open it again. See if 'res.raw.yourfile' shows up in the package explorer (it should). I also discovered that 'R.raw.yourfile' is now noticed, and you should find an entry in 'gen/*/R.java' for this.

I think there's a bug in the gen compiler, or maybe Eclipse configuration. gen seems to be very picky about just what kind of resource it wants to look at, and is also doing some name mashing. For example, R.string.xxx finds a string by name xxx, even though the string resources are under 'res.values.string.xml'. So there's clearly a lot of magic going on, maybe special kludges known only to the gods in Mountain View.

Why this fix broke it loose I have no idea.

William Barrett
  • 281
  • 3
  • 2
0

When Eclispe is starting to behave weirdly, my last trick is to remove the project from the workspace and add it again... Try also to quit and restart eclispe

Good luck!

rockeye
  • 2,765
  • 2
  • 30
  • 44
  • No luck. I dont understand... :( – Andrew May 17 '11 at 15:40
  • android can sometimes be painful with naming convention. Are you sure your filename is correct. Have you tried with foo.png ? – rockeye May 17 '11 at 15:44
  • It is the /res/raw directory. I think these files can be named anything. My file is named mystore.bks, just as in the example I'm reading. – Andrew May 17 '11 at 16:11