How to configure plugin “cordova-plugin-screen-orientation” in config.xml

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 16:24:14

问题


cordova plugin add cordova-plugin-screen-orientation

After I fetched the plugin cordova-plugin-screen-orientation with the line above I looked inside the config.xml and I couldn't find a similar line like below for the plugin.

<gap:plugin name="org.apache.cordova.media-capture" />

I already tried

  • guessing the plugin id/name (PhoneGap Build kept saying the plugin is unsupported):
    <gap:plugin name="org.apache.cordova.screen-orientation" />
    <gap:plugin name="cordova-plugin-screen-orientation" />

The last line is the plugin id/name from the plugins plugin.xml.

  • to find the plugin id/name on the sites below:

    • build.phonegap.com/plugins
    • plugins.telerik.com/cordova
    • cordova.apache.org/plugins
  • to get help by making an issue at the repository of the plugin (the issue has been deleted so I removed the link to the issue)
  • searching on stackoverflow and google with:
    • configure plugin phonegap
    • adding plugin to phonegap
  • adding src="npm":
<gap:plugin name="cordova-plugin-screen-orientation" src="npm" />`

Can someone tell me the plugin id/name or how to configure the plugin in the config.xml?


回答1:


The solution is replacing src="npm" with source="npm".

<gap:plugin name="cordova-plugin-screen-orientation" source="npm" version="1.4.0" />

Credits go to https://github.com/bau720123 for giving me the solution in the issue I created on GitHub. The issue is deleted so I can't post a link to it.

For more info on how to configure a plugin in the config.xml go here: http://docs.phonegap.com/phonegap-build/configuring/plugins/



来源:https://stackoverflow.com/questions/33563975/how-to-configure-plugin-cordova-plugin-screen-orientation-in-config-xml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!