Doh09
Doh09

Reputation: 2385

Android Studio keeps giving a file not found exception. Not sure why

I'm making an Android app in Android Studio. I'm trying to get the app to load an .xlsx file. But whenever I do so it gives me a "File not found" exception.

The file is stored in the folder that Android Studio itself created when i selected "Directory" and chose "Assets". I selected the "src/main/assets" folder.

In the screenshots below you can see the error I am getting, the folder structure, the code I use to call the file and a notification I noticed that pops up when debugging. I think the last picture with the notification may not be relevant for this error but I included it just in case it might be relevant.

What have I tried so far?

Any suggestions as to why my Android studio does not find this file?

enter image description here

enter image description here

enter image description here

enter image description here

Upvotes: 2

Views: 862

Answers (1)

Doh09
Doh09

Reputation: 2385

As CommonsWare suggested in a comment I could try look outside Android Studio. And it turned out that despite there only appearing one "Assets" folder in Android Studio there were 4 folders. The files were in "androidTest" and i moved them to "main". Then it found the file.

enter image description here

Upvotes: 1

Related Questions