html5video Cordova android插件不会使用CLI安装错误

时间:2015-04-29 13:42:15

标签: android cordova html5-video phonegap-plugins

使用CLI安装插件时会出现错误:

cordova plugin add https://github.com/jaeger25/Html5Video.git
Failed to install 'jaeger.Html5Video':Error: Expected fetched plugin to have ID "org.apache.cordova.device" but got "cordova-plugin-device".
    at checkID (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:163:15)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:147:9
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:749:13)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:557:44
    at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:442:13)
Error: Expected fetched plugin to have ID "org.apache.cordova.device" but got "cordova-plugin-device".
    at checkID (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:163:15)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:147:9
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:749:13)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:557:44
    at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:442:13)

有没有人有解决方案?

1 个答案:

答案 0 :(得分:1)

我安装了插件没有问题

$ cordova -v
4.3.0

$ cordova plugin
jaeger.Html5Video 1.2.1 "Html5Video"
org.apache.cordova.device 0.3.0 "Device"

最新的cordova cli 5.0版包含一些重大变化。核心插件现在为available through npm,其ids have been modified遵循npm约定。 org.apache.cordova.device已成为cordova-plugin-device。我猜这是你的问题

在HTML5Video git repo中,plugin.xml指定了旧ID的依赖关系。

<dependency id="org.apache.cordova.device" url="https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git" commit="master" subdir="." />

我猜你已经安装了cordova-cli 5.0,并使用新的cordova-plugin-device id找到了最新版本的设备依赖项。

HTML5Video plugin.xm需要更新设备依赖项的ID。您可以分叉HTML5Videp仓库并更新依赖关系

<dependency id="cordova-plugin-device" url="https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git" commit="master" subdir="." />

然后做

cordova plugin add http://url/to/your/repo/Html5Video.git

您也可以在repo url上指定一个版本,以获取HTML5Video插件所需的设备插件版本

<dependency id="org.apache.cordova.device" url="https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git@0.3.0" commit="master" subdir="." />