do i really need a config plugin to add one line to AndroidManifest, first expo app config-plugin
I need one attribute in the manifest for an SDK I am integrating. Their docs say "add this line to AndroidManifest.xml".
Everything I read says do not edit the file directly in a managed project, write a config plugin instead. Writing a whole plugin to add one line feels like enormous ceremony for a one-line change and I want to check I am not overcomplicating my first app.
@rest_day_rita · 8mo ago · 3 replies
Probably not, for one line. Work down this list:
app.jsonfield? Permissions, intent filters, a lot of common manifest keys are exposed directly and people write plugins for things that were one config key away.expo-build-propertiesdo it? It covers a surprising amount of the Gradle and manifest surface.And if you do get to step 3, a plugin for one manifest attribute is about fifteen lines with
withAndroidManifest. It is a function that takes config, mutates a parsed object, returns config. Not a mountain.The thing you must not do is edit
android/AndroidManifest.xmlby hand, because the next prebuild regenerates it and your line silently disappears. You will not notice at the time. You will notice on a build three weeks later when the SDK stops working and nothing in your diff explains it.Reply
Report
@stack_trace_sy · 8mo ago
The silent disappearance is the entire reason plugins exist. It is not ceremony, it is the only mechanism by which your change survives a regeneration. Once you see it that way the fifteen lines stop feeling like overhead.
Reply
Report
@bench_dogged · 8mo ago
Run
npx expo prebuild --cleanand read the generated manifest afterwards. Seeing your attribute actually appear in the output is a 30 second confirmation and it is weirdly satisfying the first time.Reply
Report