Mike Baxter
Mike Baxter

Reputation: 7258

Invalid resource directory name (Eclipse)

I am trying to read some text from a .txt file in my project directory in android. I have a file called "test.txt" in my assets folder. However any text I write in this file causes a compiler error: Invalid resource directory name. Why is this? I thought I could put files into the assets directory without any problem. Am I missing something, do I need to declare all assets in the manifest or something? My assets folder is in the root project folder, eg Project/Assets/test.

Upvotes: 0

Views: 3130

Answers (3)

Denis Kutlubaev
Denis Kutlubaev

Reputation: 16124

I had the same error, when I added a new text file with some data to Assets folder by drag and drop. Cleaning the project helped.

Upvotes: 0

Chintan Rathod
Chintan Rathod

Reputation: 26034

However any text I write in this file causes a compiler error

You can not write anything in Assets at runtime. Assets folders don't exist on the phone. They're compiled into the package. Assets only provides reading facility.

If you want to write something, please use your external directory or Cache Directory provided by application.

Take a look at Storage Options.

Upvotes: 1

methical
methical

Reputation: 131

Your problem is located in the res folder where only folders with a set of allowed names by android can be stored.

My guess is, did you put the assets folder into the res folder? List your structure of folders in the res folder please.

Upvotes: 1

Related Questions