- Home /
Accessing custom resources on Android
Hi Guys
I am having issues with being able to access custom resources on Android that are outside the resources folder.
For now, I am editing my apk each time to include my custom resource files in the apk and signing it. I will later write an editor script to make sure they are copied during the build process to the right folder. I first tried using the Application.dataPath to read my files and placed the my XML files at the root of the apk. But the application was unable to access the files in that location.
Next I tried using Application.persistentDataPath to acces my files and tried placing my XML files inside the res folder of the apk as well as the asset folder, but still the application was unable to find the files. Finally I had to check the path from which the application was trying to access the files using logcat, and placed my XML files into the folder to get my app working.
Can anyone help with figuring out where inside the apk should I be placing my files so that they are automatically copied to the folder that will be accessed by Application.persistentDataPaht? Also some easy way to be able to copy the files to that location during the build process?
Any or all help will be appreciated.
Thanks in advance Rahul
Why do you need to access resources from outside? We have an Android Plugin that requires text and png. We just embed them in Assets/Plugins/Android/res.
Answer by kemuri · Dec 02, 2016 at 10:48 PM
Embed them in Assets/Plugins/Android/res. They are accessible via `getResources().getIdentifier(...)' from Android. Unfortunately this is now deprecated but still works.
Your answer
Follow this Question
Related Questions
android apk size not getting much smaller 1 Answer
Why there is a delay to load resources for android and webgl? 0 Answers
Application.CaptureScreenshot() does not save any image on Android while it does on Editor! 0 Answers
Lot of resource files 1 Answer
Opening data file from asset folder 2 Answers