phonegap build错误插件不在npm:Device上

时间:2015-11-26 06:12:30

标签: phonegap-build cordova-plugins

我正在使用phonegap-version cli-5.2.0我无法构建apk。错误在这里 错误 - 以下插件,插件版本或此插件的依赖性不在npm:Device

我的config.xml 这是我的配置文件,我的插件在下面给出 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>

2 个答案:

答案 0 :(得分:0)

好的,我已经修复了你的config.xml,但你的index.html也可能有错误。我建议你也发帖。

此外,我删除了图标,插件,首选项等,因为您可以随时添加它们。这个例子让你工作。

您应该在过去60天内阅读Phonegap Build blog,并且在接下来的30天内会有更多更改。如果你有机会浏览Cordova blog

你也应该略读一下:Top Mistakes by Developers new to Cordova/Phonegap
并阅读这些

词汇表 - deprecated表示 - 已被视为旧版,并计划逐步停用,但仍可供使用。

您的修正

注意您的应用程序现在已不确定。由您来保护您的APP。
阅读: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>

答案 1 :(得分:0)

更改插件名称和值是插件的包名称。例如:

</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>