0

I'm trying to load some custom XML data into an Android application, so I put it in the assets folder so I can read it. However Eclipse won't let me build my project; it says "invalid resource directory name" for the assets folder! I thought assets was a valid folder name in an Android project?

What am I missing? Did the folder somehow get some metadata that marks it as a resource folder instead of an asset folder? Or is the assets folder only supported in newer versions of Android? (I'm using SDK level 10)

ekolis
  • 6,270
  • 12
  • 50
  • 101

2 Answers2

2

Put that XML file in your XML folder within res folder.

pixelscreen
  • 1,945
  • 2
  • 18
  • 40
  • Oh, thanks! I didn't see "xml" as a valid folder under res on the official list... – ekolis Sep 04 '12 at 13:13
  • Actually I had to put it under raw, not xml - for some reason I was getting an "unterminated entity reference" error when I put it under xml! Maybe Android was wrapping it in something when I did that? – ekolis Sep 04 '12 at 13:30
  • I'm not sure because I haven't attempted that :P But here is a reference to that error you were getting, although it doesn't seem relevant here at all. http://stackoverflow.com/a/10851958/735675 – pixelscreen Sep 04 '12 at 13:32
  • Yeah, I checked my XML for ampersands, and didn't find any - as for unclosed tags, I guess it's possible, but the same XML file loads up just fine when I put it in the raw folder, as well as in the C# desktop application on which I'm basing this Android app! – ekolis Sep 04 '12 at 15:02
0

The assets directory is not under res but in project root.

laalto
  • 150,114
  • 66
  • 286
  • 303