Platform-specific config
Bug Report
Capacitor Version
Latest Dependencies:
@capacitor/cli: 3.3.2
@capacitor/core: 3.3.2
@capacitor/android: 3.3.2
@capacitor/ios: 3.3.2
Installed Dependencies:
@capacitor/android: not installed
@capacitor/ios: not installed
@capacitor/cli: 3.3.2
@capacitor/core: 3.3.2
Platform(s)
iOS, Android
Current Behavior
Run npx cap init, answer Y to "Migrate Cordova preferences from config.xml?". Any preferences inside a "platform" tag (i.e. <platform name="android"></platform> tag, or <platform name="ios"></platform>) is ignored.
Furthermore, the documentation does not explain how those platform-specific preferences can be set, whether in capacitor.config.json or elsewhere. The closest reference is
If your plugin requires variables or settings to be set, you’ll need to apply those configuration settings manually by mapping between the plugin’s plugin.xml and required settings on iOS and Android.
Does this mean manually editing the config.xml in the individual platform directories? That won't work because npx cap copy overwrites it.
Expected Behavior
Cordova supports the <platform> tag, which can wrap other elements. There should be a clearly documented way to support platform-specific config in Capacitor that survives npx cap copy.
Additional Context
See #2246
Any updates? It's realy usefull feature!
Yep, would be nice to have, now I cannot insert my APP_SECRET: depending on platform
There doesn't seem to be a plan
Take a look at our Trapeze project which can handle many of these tasks: https://trapeze.dev/
It supports environment variables and can modify iOS and Android projects and is a good substitute for (and even goes beyond) some of the old platform and plugin configuration features Cordova has