How to create file inside android/src/main/res/xml with config plugins?

I am trying to use Snapchat’s SnapKit SDK without my Expo v47 app using expo-dev-client.

I have done most of the hard work for setting up the config plugin and plan to release it as an open source project. However, I am stuck on the last step for the Android part of the setup.

This step requires me to define paths in the res/xml/file_paths.xml file. However, since this file does not exist in my project, I am not sure how to create it using a config plugin.

Any help would be much appreciated!

Here’s a plugin I wrote a while ago. I don’t claim to be an expert, but this worked:

It’s a good idea to look for examples in the Expo repositories, though. For instance I found this now by searching for `fs.writeFile’:

I think you’d want to mark it as a DangerousMod
Then basically just write the file however it makes sense. But ideally see what other Expo config plugins do so you can do it the same way. e.g. instead of using mkdirSync like I did, you might want to use ensureDir.

1 Like

Thank you @wodin! This worked great. I have developed my plugin and am planning on releasing it on my Github soon: ansh (Ansh) · GitHub

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.