我试图将this plugin添加到PhoneGap应用程序中。
我使用了这个命令:
$ cordova plugin add cordova-media-with-compression
我可以看到插件正确添加到运行此插件的插件列表中:
$ phonegap plugin list
但是,当我使用 PhoneGap开发者应用程序(在iPhone上)时,该插件不可用。
我正在运行此代码,以便在运行时获取已安装插件的列表:
document.addEventListener("deviceready", function () {
var pluginList = cordova.require("cordova/plugin_list").metadata;
console.log(JSON.stringify(pluginList));
});
如果我从浏览器或PhoneGap开发者应用程序运行应用程序,上面的代码将返回两组不同的插件。从浏览器,我得到了这个:
{
"cordova-media-with-compression": "2.1.0",
"cordova-plugin-battery-status": "1.1.2",
"cordova-plugin-camera": "2.1.1",
"cordova-plugin-compat": "1.1.0",
"cordova-plugin-console": "1.0.4",
"cordova-plugin-contacts": "2.0.1",
"cordova-plugin-device": "1.1.3",
"cordova-plugin-device-motion": "1.2.2",
"cordova-plugin-device-orientation": "1.0.4",
"cordova-plugin-dialogs": "1.2.1",
"cordova-plugin-file": "4.3.0",
"cordova-plugin-file-transfer": "1.5.1",
"cordova-plugin-geolocation": "2.1.0",
"cordova-plugin-globalization": "1.0.4",
"cordova-plugin-inappbrowser": "1.3.0",
"cordova-plugin-network-information": "1.2.1",
"cordova-plugin-splashscreen": "3.2.2",
"cordova-plugin-statusbar": "2.1.3",
"cordova-plugin-vibration": "2.1.2",
"cordova-plugin-whitelist": "1.2.2"
}
从 PhoneGap开发者应用我得到了这个:
{
"com.wikitude.phonegap.WikitudePlugin": "5.3.0",
"cordova-plugin-battery-status": "1.2.0",
"cordova-plugin-ble-central": "1.1.2",
"cordova-plugin-camera": "2.3.0",
"cordova-plugin-compat": "1.0.0",
"cordova-plugin-console": "1.0.4",
"cordova-plugin-contacts": "2.2.0",
"cordova-plugin-device": "1.1.3",
"cordova-plugin-device-motion": "1.2.2",
"cordova-plugin-device-orientation": "1.0.4",
"cordova-plugin-dialogs": "1.3.0",
"cordova-plugin-file": "4.3.0",
"cordova-plugin-file-transfer": "1.6.0",
"cordova-plugin-geolocation": "2.4.1-dev",
"cordova-plugin-globalization": "1.0.4",
"cordova-plugin-inappbrowser": "1.5.0",
"cordova-plugin-insomnia": "4.2.0",
"cordova-plugin-media": "2.4.0",
"cordova-plugin-media-capture": "1.4.0",
"cordova-plugin-network-information": "1.3.0",
"cordova-plugin-splashscreen": "4.0.0",
"cordova-plugin-statusbar": "2.2.0",
"cordova-plugin-whitelist": "1.3.0",
"cordova-plugin-x-socialsharing": "5.1.3",
"phonegap-plugin-barcodescanner": "6.0.3",
"phonegap-plugin-contentsync": "1.2.5",
"phonegap-plugin-mobile-accessibility": "1.0.4",
"phonegap-plugin-push": "1.8.3"
}
如您所见,在第一个列表中有插件cordova-media-with-compression
,而在第二个列表中则没有。{/ p>
为什么两个插件列表不相等?如何在 PhoneGap Developer App 中获取新安装的插件?
答案 0 :(得分:1)
我发现 Phonegap开发者应用带有一组开箱即用的插件,无法添加其他外部插件:http://docs.phonegap.com/references/developer-app/troubleshoot-faq/
如果您在项目中使用的插件未在此列表中显示,则无法使用开箱即用的PhoneGap Developer App。 但是,您可以在本地创建your own custom build of the PhoneGap Developer app并在其中包含任何其他插件。
官方建议是创建Developer App的自定义版本。
这是关于github关于这个问题的一些讨论:
https://github.com/phonegap/phonegap-app-developer/issues/247 https://github.com/phonegap/phonegap-app-developer/issues/209