电话间隙
config.xml
... <preference name="android-build-tool" value="gradle" /> ... <preference name="phonegap-version" value="cli-7.0.1" /> ... <preference name="cordova.plugins.diagnostic.modules" value="CAMERA" /> .... <plugin name="cordova.plugins.diagnostic"/>
我的应用程序无法使用蓝牙,但是安装时需要获得与蓝牙设备链接的权限
音位间隙日志
... ... Fetching plugin "cordova.plugins.diagnostic" via npm Installing "cordova.plugins.diagnostic" at "4.0.8" for android ... ...
如果我删除
最佳答案
诊断插件使用 npm postinstall hook运行 hook script它应用 config.xml 中的首选项来注释掉不需要的模块。
因此as documented :
It's vital that the preference be added to your config.xml before you install the plugin, otherwise the preference will not be applied and all modules will be added. This is because, due to limitations of the Cordova CLI hooks, this plugin must use the npm install process to apply the module preferences and this runs before the Cordova CLI when installing a plugin. If you change the modules specified in the preference, you'll need to uninstall then re-install the plugin to your project to apply the changes.
所以你应该尝试:
cordova plugin rm cordova.plugins.diagnostic --nosave
npm uninstall cordova.plugins.diagnostic
cordova plugin add cordova.plugins.diagnostic --nosave
注意:如果您在项目或 node_modules
中使用符号链接(symbolic link),这可能会导致脚本失败,因为它无法解析正确的相对路径。
免责声明:我是 Cordova 诊断插件的作者。
关于android - 没有蓝牙的蓝牙的phonegap权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51230731/