OK, I see from those links that this is a lot more complicated than expected.
I don’t have any tutorials for you, but I think looking at example plugins that use withAndroidManifest
and similar mods (e.g. withAndroidStyles
) should help. I normally go looking in the various Expo repositories for config plugins that seem similar to what I want to do.
withAndroidManifest
and others that work with XML files basically transform the XML file into JavaScript objects. The config plugin manipulates that. Then afterwards it gets converted back to XML and written to disk. xml2js
is used for this. See xml2js - npm
I can’t claim to be an expert, but have a look at these:
- rn-hce-test/withAndroidApplicationAttributes.js at main · wodin/rn-hce-test · GitHub
- rn-hce-test/withAndroidColorEdgeEffect.js at main · wodin/rn-hce-test · GitHub
- rn-hce-test/withReactNativeHce.js at main · wodin/rn-hce-test · GitHub
For testing the config plugin I normally make changes to the code, run npx expo prebuild
or npx expo prebuild --clean
and compare the resulting AndroidManifest.xml
(or whatever) with what I am expecting.
The official Expo config plugins try to work even if you re-run them multiple times without using the --clean
option and I try to do the same.