0

I'm attempting to read an audio file using:

File audio = new File("src/test/resources/test.flac");

But I'm a bit confused whether or not I can do this when debugging using an emulator. If you can, when you do the above, what exactly is the root/relative folder?

I'm currently debugging using the emulator on Windows and I have made sure that the file is in the test/resources directory, but using:

if(audio.exists())

Always returns false.

Is there something I'm missing?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
BoyUnderTheMoon
  • 741
  • 1
  • 11
  • 27
  • If you try to read a file then you know where the file resides. So use an absolute path. – greenapps Aug 15 '16 at 16:17
  • It would help if you added the OS you are using. Also, any information relative to the project, emulator and android studio installation and directory structure would help. – Heather92065 Aug 15 '16 at 19:41
  • Possible duplicate of [Access resource files in Android](http://stackoverflow.com/questions/4081763/access-resource-files-in-android) – Robert Aug 19 '16 at 12:04
  • 1
    When the code is compiled, the `src/` directory no longer exists. To put files in your app, you need to use an Assets folder – OneCricketeer Aug 19 '16 at 12:04

0 Answers0