构建应用程序时出现 PhoneGap 错误
Posted
技术标签:
【中文标题】构建应用程序时出现 PhoneGap 错误【英文标题】:PhoneGap Error when Building App 【发布时间】:2018-03-29 21:17:27 【问题描述】:在 PhoneGap 上构建我的安卓应用。我离开了一段时间的开发,得到了一部新手机,想安装我的 apk。
我没有对我的代码进行任何更改,所以它应该能够构建并且很好,但是它抛出了这个错误:
Error - The following plugin, plugin version or a dependancy of this plugin is not on npm: org.apache.cordova.media-capture
我的 config.xml 如下所示:
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" id="takenOutForSecurity" version="5.4.9">
<preference name="phonegap-version" value="cli-6.3.0" />
<preference name="android-build-tool" value="gradle" />
<gap:plugin name="cordova-plugin-whitelist" source="npm" />
<access origin="*" />
<allow-navigation href="*" />
<allow-intent href="*" />
<name>Beer Portfolio</name>
<description>Know Your Beer</description>
<author href="takenOutForSecurity" email="takenOutForSecurity">Mike</author>
<content src="index.html" />
<preference name="permissions" value="none" />
<preference name="orientation" value="default" />
<preference name="target-device" value="universal" />
<preference name="fullscreen" value="false" />
<preference name="webviewbounce" value="false" />
<preference name="disallowOverscroll" value="true" />
<preference name="prerendered-icon" value="true" />
<preference name="stay-in-webview" value="false" />
<preference name="ios-statusbarstyle" value="black-opaque" />
<preference name="detect-data-types" value="true" />
<preference name="exit-on-suspend" value="false" />
<preference name="show-splash-screen-spinner" value="true" />
<preference name="auto-hide-splash-screen" value="true" />
<preference name="disable-cursor" value="false" />
<preference name="android-minSdkVersion" value="10" />
<preference name="android-targetSdkVersion" value="19" />
<preference name="android-installLocation" value="auto" />
<gap:plugin name="cordova-plugin-camera" source="npm" />
<gap:plugin name="org.apache.cordova.media-capture" source="npm" />
<gap:plugin name="org.apache.cordova.console" source="npm" />
<gap:plugin name="org.apache.cordova.contacts" source="npm" />
<gap:plugin name="org.apache.cordova.device-motion" source="npm" />
<gap:plugin name="org.apache.cordova.device-orientation" source="npm" />
<gap:plugin name="org.apache.cordova.dialogs" source="npm" />
<gap:plugin name="org.apache.cordova.file" source="npm" />
<gap:plugin name="org.apache.cordova.file-transfer" source="npm" />
<gap:plugin name="org.apache.cordova.inappbrowser" source="npm" />
<gap:plugin name="org.apache.cordova.media" source="npm" />
<gap:plugin name="org.apache.cordova.network-information" source="npm" />
<gap:plugin name="org.apache.cordova.splashscreen" source="npm" />
<gap:plugin name="org.apache.cordova.vibration" source="npm" />
<icon src="icon.png" />
<gap:splash src="splash.png" gap:platform="android" gap:qualifier="port-ldpi" />
<gap:splash src="splash.png" gap:platform="android" gap:qualifier="port-mdpi" />
<gap:splash src="splash.png" gap:platform="android" gap:qualifier="port-hdpi" />
<gap:splash src="splash.png" gap:platform="android" gap:qualifier="port-xhdpi" />
<gap:splash src="splash.png" gap:platform="blackberry" />
<gap:splash src="splash.png" gap:platform="ios" />
<gap:splash src="splash.png" gap:platform="ios" />
<gap:splash src="splash.png" gap:platform="ios" />
<gap:splash src="splash.png" gap:platform="ios" />
<gap:splash src="splash.png" gap:platform="ios" />
<gap:splash src="splash.png" gap:platform="winphone" />
<access origin="*" />
<gap:plugin name=" phonegap-plugin-barcodescanner" source="npm" />
<gap:plugin name="uk.co.workingedge.phonegap.plugin.launchnavigator" source="npm" />
<gap:plugin name="cordova-plugin-directions" source="npm" />
<gap:config-file platform="ios" parent="NSCameraUsageDescription" overwrite="true">
<string>We are using the Camera to scan barcodes</string>
</gap:config-file>
<gap:config-file platform="ios" parent="NSPhotoLibraryUsageDescription" overwrite="true">
<string>We are using the photo library to scan barcodes</string>
</gap:config-file>
<!-- iPhone / iPod Touch - lower 4s -->
<icon src="icon-57.png" gap:platform="ios" />
<icon src="icon.png" gap:platform="ios" />
<icon src="icon-72.png" gap:platform="ios" />
<icon src="152.png" gap:platform="ios" />
<icon src="icon-120.png" gap:platform="ios" />
<icon src="76.png" gap:platform="ios" />
<icon src="icon-40.png" gap:platform="ios" />
<!-- iPhone / iPod Touch - 5-5s -->
<icon src="icon.png" gap:platform="ios" />
<icon src="icon.png" gap:platform="ios" />
<!-- iPhone6-6+ -->
<icon src="icon.png" gap:platform="ios" />
<!-- Settings Icon -->
<icon src="icon-29.png" gap:platform="ios" />
<icon src="icon.png" gap:platform="ios" />
<!-- Spotlight Icon -->
<icon src="icon.png" gap:platform="ios" />
<icon src="icon.png" gap:platform="ios" />
<plugin name="cordova-plugin-whitelist" version="1" source="npm" />
<gap:plugin name="cordova-plugin-geolocation" source="npm" />
<feature name="http://api.phonegap.com/1.0/battery" />
<feature name="http://api.phonegap.com/1.0/camera" />
<feature name="http://api.phonegap.com/1.0/network" />
<feature name="http://api.phonegap.com/1.0/notification" />
<gap:plugin name="cordova-plugin-x-socialsharing" source="npm" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
我也尝试将cli-6.3.0
更改为cli-8.0.0
,但这也没有解决问题。
【问题讨论】:
【参考方案1】:2016 年,PhoneGap Build 转而使用 NPM 作为插件宿主。更多详情here.
标准 Cordova 插件(例如媒体捕获)现在的名称中以“cordova-plugin”开头。尝试改用cordova-plugin-media-capture。在您的 config.xml 中,这将是:
<plugin name="cordova-plugin-media-capture" spec="3.0.1" source="npm" />
【讨论】:
以上是关于构建应用程序时出现 PhoneGap 错误的主要内容,如果未能解决你的问题,请参考以下文章
从 Phonegap Build 提交 .ipa 时出现错误 ITMS-90046
使用带有 HTML5 和 jquery 的 phonegap 1.3.0 创建 android 应用程序时出现无限弹出错误?