1

So, I've seen many posts on this, but none has helped. I want to work with the assets folder, for organizational purposes. The images below show where the 'assets' folder is, along with the app.imi options of where it should be. I have tested this, and in the >exploded-aar/com../appcompat-v7/19.1.0/assets ... the files inside this seem to work. I can call on the .mp3 file and load and play it correctly (Though a few times it did not recognize it. Even when it was inside a folder, inside of the directory.) In the src/main/assets folder, all the files are ignored. Is there a specific way I have to call this? In other words, must I also link the actual folder it is it? src/main/assets/music to load up the riseofcc.mp3?

enter image description here

I do not have 10 reputation to post images, so sorry for only links.

EDIT:Also I am using Android Studio 0.5.7

ANSWERED: Thanks for Xavier Duchrohet for explaining exploded-aar is for the application's dependencies. I have learned that when calling upon a file inside your asset's folder using the code:

AssetManager assetManager = getAssets();
InputStream inputStream = null;
AssetFileDescriptor descriptor = assetManager.openFd("sound/explosion.ogg");

You must include the folder's parent inside the arguement. Android Studio's app.iml has the asset's directory (src/main/assets) inside of its configuration's options.

Azurai
  • 107
  • 2
  • 10
  • I can only post one link, here is the code itself: [IMG]http://i.imgur.com/WkW3Wwf.png[/IMG] – Azurai May 05 '14 at 19:56
  • Are you having trouble figuring out where the folder goes or how to access the asset? – bestdayever May 05 '14 at 20:59
  • Well, I'm confused is all. The internet tell me that the src/main/assets is the place for assets. But yet, Android Studio tells me the assets/ is in the exploded-aar folder. And well, if it can be both, then I suppose the best place for it to be(for practice) in is the first said place. Then my question would be, how to I access it there, is the code in my first comment is not right? I'm following a book, and so far its just going through basics. – Azurai May 05 '14 at 21:26
  • exploded-aar is for your dependencies. they get unzipped there so that studio can use the content. For your own files, put them in src/... – Xavier Ducrohet May 05 '14 at 22:50

1 Answers1

0

Normally, to include sound files, I create a folder called raw, inside the app / src / main / res. That is, I right click on the folder res and from the menu that appears, choose: New / Android Resource Diretory. Renaming in the window that appears, the Directory name field values for raw. How it works for me, I hope this might have helped him.