【问题标题】:Cordova plugin not working (not defined)Cordova 插件不工作(未定义)
【发布时间】:2017-05-10 12:27:51
【问题描述】:

我正在使用 Phonegap,我想使用这个 m 插件:https://github.com/srehanuddin/Cordova-Plugin-Bluetooth-Printer

当我尝试使用这个插件时,不幸的是控制台打印了这个信息:

Uncaught ReferenceError: BTPrinter is not defined

但如果我使用 cmd 并检查了插件: ...转到应用文件夹并输入 phonegap plugin list 我明白了:cordova-plugin-bluetooth-printer 0.0.1-dev "BluetoothPrinter"

你知道哪里有问题吗?

confix.xml:

`<gap:plugin name="cordova-plugin-bluetooth-printer" />`

谢谢!

【问题讨论】:

  • 很大程度上取决于构建的设置方式。很可能任何进程都没有将插件 src 复制到正确的位置,或者您实际运行的应用程序没有在库存在的任何位置查找。
  • 我使用了Phonegap桌面应用程序(只需点击make new project)。
  • App 文件夹包含以下子文件夹:.cordova、hook、platforms、plugins(包含蓝牙打印机插件)、red、www、confix.xml
  • 你添加了android/ios平台吗?
  • 只需尝试删除当前平台并添加新平台(android/ios),然后重新安装插件。

标签: cordova cordova-plugins


【解决方案1】:

更新: 如果我尝试通过 build.phonegap.com 构建:

Error - Plugin error (you probably need to remove plugin files from your app): //github.com/srehanuddin/Cordova-Plugin-Bluetooth-Printer.git#1.0.0": support for subdirectories is deprecated and will be removed in Cordova@7 Fetching plugin "https://github.com/srehanuddin/Cordova-Plugin-Bluetooth-Printer.git" via git clone Cloning full repository Failed to fetch plugin https://github.com/srehanuddin/Cordova-Plugin-Bluetooth-Printer.git via git. Either there is a connection problems, or plugin spec is incorrect: Error: git: Command failed with exit code 1 Error output: error: pathspec '1.0.0' did not match any file(s) known to git. - 

【讨论】:

    猜你喜欢
    • 2014-12-26
    • 2018-08-04
    • 2014-09-19
    • 1970-01-01
    • 2014-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-30
    相关资源
    最近更新 更多