Issue
I'm using the xamarin ide to build and output APK. I need to store json configuration files, therefore i put them under Resources/config.
The build action of the file is set to AndroidResource. When i try to build the project, i get the following error:
Invalid resource directory name "res config".
Things that i tried:
- Renaming the resources files involved
- Setting the build action of the files to None => build is working but the resources files disappear.
The resources are not referenced in any way in Resource.designer.cs.
Does anyone has an idea on how to solve this error? Thanks.
Solution
You should store .json files in either your /Assets
or /Resources/raw
folders instead. You can then use the respective methods to open them:
Context.Resources.OpenRawResource(Resource.Raw.filename)
Context.Resources.Assets.Open("filename")
Use /Resources/raw when you need an actual Resource ID to be generated, otherwise just stick it inside the /Assets folder.
Answered By - Jon Douglas
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.