phonegap build error plugin is not on npm: Device

荒凉一梦 提交于 2019-12-12 02:24:02

问题


I am using phonegap-version cli-5.2.0 i could not build apk. error is here below Error - The following plugin, plugin version or a dependancy of this plugin is not on npm: Device

my config.xml this is my config file my plugins are given below org.apache.cordova.core.geolocation,Device,Logger,Compass,NetworkStatus,Debug Console,Geolocation,SplashScreen,Battery,Globalization

 <?xml version="1.1" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0"  id = "com.test.www" version="1.1" >
    <name>test</name>    
    <description>
       test
    </description>
    <preference name="permissions" value="none"/>
    <gap:plugin name="org.apache.cordova.core.geolocation" />           
    <feature name="Geolocation">
         <param name="ios-package" value="CDVLocation" />
    </feature>
    <plugins>
            <plugin name="Device" value="CDVDevice" />
            <plugin name="Logger" value="CDVLogger" />
            <plugin name="Compass" value="CDVLocation" />
            <plugin name="NetworkStatus" value="CDVConnection" />
            <plugin name="Debug Console" value="CDVDebugConsole" />
            <plugin name="Geolocation" value="CDVLocation" />
            <plugin name="SplashScreen" value="CDVSplashScreen" />
            <plugin name="Battery" value="CDVBattery" />
            <plugin name="Globalization" value="CDVGlobalization" />

    </plugins>
  <preference name="phonegap-version" value="cli-5.2.0" />


  <!--<preference name="android-windowSoftInputMode" value="adjustPan" />-->
  <preference name="android-windowSoftInputMode" value="adjustResize" />

    <icon src="images/ldpi.png"  gap:platform="android" gap:density="ldpi" />
    <icon src="images/mdpi.png"  gap:platform="android" gap:density="mdpi" />
    <icon src="images/hdpi.png"  gap:platform="android" gap:density="hdpi" />
    <icon src="images/xhdpi.png"  gap:platform="android" gap:density="xhdpi" />

    <!-- iPhone icons -->
    <icon src="images/57.png"  gap:platform="ios" width="57" height="57" />
    <icon src="images/114.png" gap:platform="ios" width="114" height="114" />


    <icon src="images/72.png"  gap:platform="ios" width="72" height="72" />
    <icon src="images/76.png" gap:platform="ios" width="76" height="76" />
    <icon src="images/120.png"  gap:platform="ios" width="120" height="120" />
    <icon src="images/152.png" gap:platform="ios" width="152" height="152" />


    <!-- Android splashes -->
    <gap:splash src="images/sldpi.png"  gap:platform="android" gap:density="ldpi" />
    <gap:splash src="images/smdpi.png"  gap:platform="android" gap:density="mdpi" />
    <gap:splash src="images/shdpi.png"  gap:platform="android" gap:density="hdpi" />
    <gap:splash src="images/sxhdpi.png" gap:platform="android" gap:density="xhdpi" />

    <!-- iPhone splashes -->
    <gap:splash src="images/320x480.png" gap:platform="ios" width="320" height="480" />
    <gap:splash src="images/640x960.png" gap:platform="ios" width="640" height="960" />
    <gap:splash src="images/640x1136.png" gap:platform="ios" width="640" height="1136"  />

  <gap:plugin name="com.devexpress.plugins.devextremeaddon" version="1.0.1" />
  <gap:plugin name="com.phonegap.plugin.statusbar" version="1.1.0" />
  <gap:plugin name="org.apache.cordova.splashscreen" version="0.3.4" />
  <gap:plugin name="org.li8.inappbrowser" version="0.1" />
  <gap:plugin name="org.apache.cordova.network-information" version="0.2.12" />
  <gap:plugin name="com.danielcwilson.plugins.googleanalytics" version="0.6.1" />

  <gap:plugin name="nl.x-services.plugins.socialsharing" version="3.8.1" />

  <preference name="SplashScreen" value="foo" />

   <preference name="SplashScreenDelay" value="8000" />

  <access origin="*" />
</widget>

回答1:


Okay, I've fixed up your config.xml, but you likely have errors in your index.html also. I would suggest you post that as well.

Also, i removed the icons, plugins, preferences, and more, because you can always add those back. This example gets you working.

You should read the Phonegap Build blog for the last 60 days or so, and there are more changes coming in the next 30 days. If you get a chance skim through the Cordova blog as well.

You should also skim this: Top Mistakes by Developers new to Cordova/Phonegap
AND READ these

  • HOW TO apply the Cordova/Phonegap the whitelist system
  • Core Plugins Setup

Glossary - deprecated means - considered old, and planned to be phased out, but still available for use.

Your Fixes

NOTE YOUR APP IS NOW INSECURE. IT IS UP TO YOU TO SECURE YOUR APP.
Read: HOW TO apply the Cordova/Phonegap the whitelist system

<?xml version="1.1" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0"  id = "com.appbogoo.www" version="1.1" >
    <name>BOGOO</name>    
    <description>
       BOGOO
    </description>

    <preference name="phonegap-version" value="cli-5.2.0" />

    <plugin name="cordova-plugin-geolocation"    source="npm" spec="1.0.1" />
    <plugin name="cordova-plugin-inappbrowser"   source="npm" spec="1.0.1" />
    <plugin name="cordova-plugin-network-information" source="npm" spec="1.0.1" />
    <plugin name="cordova-plugin-splashscreen"   source="npm" spec="2.1.0" />
    <plugin name="cordova-plugin-statusbar"      source="npm" spec="1.0.0" />

    <!-- No longer available -->
    <!-- <gap:plugin name="com.devexpress.plugins.devextremeaddon" version="1.0.1" /> -->
    <!-- Deprecated -->
    <!-- <gap:plugin name="com.danielcwilson.plugins.googleanalytics" version="0.6.1" /> -->
    <plugin name="cordova-plugin-google-analytics source="npm" spec="0.8.1" />
    <!-- Deprecated -->
    <!-- <gap:plugin name="nl.x-services.plugins.socialsharing" version="3.8.1" /> -->
    <plugin name="cordova-plugin-x-socialsharing source="npm" spec="5.0.7" />

    <plugin name="cordova-plugin-whitelist"      source="npm" spec="1.1.0" />
    <allow-navigation href="*" />
    <allow-intent href="*" />
    <access origin="*" /> <!-- Required for iOS9 -->
</widget>



回答2:


Change Plugin name and value is the package name of plugin. example:

</description>
<preference name="permissions" value="none"/>
<gap:plugin name="org.apache.cordova.core.geolocation" />           
<feature name="Geolocation">
     <param name="ios-package" value="CDVLocation" />
</feature>
<plugins>
        <plugin name="cordova-plugin-device" value="org.apache.cordova.Device" />

        <plugin name="cordova-plugin-network-information" value="CDVConnection" />
        <plugin name="Debug Console" value="CDVDebugConsole" />
        <plugin name="cordova-plugin-globalization" value="CDVLocation" />
        <plugin name="cordova-plugin-splashscreen" value="CDVSplashScreen" />
      //etc...

</plugins>


来源:https://stackoverflow.com/questions/33931728/phonegap-build-error-plugin-is-not-on-npm-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!