Plugins PhoneGap插件不工作(未定义)

Plugins PhoneGap插件不工作(未定义),plugins,cordova,Plugins,Cordova,我正在通过PhoneGap开发我的第一个应用程序,我真的被非常令人沮丧的插件问题所困扰 我将用Phonegap文档中的示例解释这个问题,以避免代码问题。以下是我为从头开始创建应用程序并添加插件而遵循的工作流程: $ phonegap create helloworld com.phonegap.helloworld HelloWorld [phonegap] created project at /.../Phonegap_Dev/helloworld $ cd helloworld/ $ co

我正在通过PhoneGap开发我的第一个应用程序,我真的被非常令人沮丧的插件问题所困扰

我将用Phonegap文档中的示例解释这个问题,以避免代码问题。以下是我为从头开始创建应用程序并添加插件而遵循的工作流程:

$ phonegap create helloworld com.phonegap.helloworld HelloWorld
[phonegap] created project at /.../Phonegap_Dev/helloworld
$ cd helloworld/
$ cordova platform add ios
Creating ios project...
Preparing ios project
$ cordova platform add android
Creating android project...
Preparing android project
$ cordova plugin add org.apache.cordova.dialogs
Fetching plugin from "org.apache.cordova.dialogs"...
Starting installation of "org.apache.cordova.dialogs" for android
Preparing android project
org.apache.cordova.dialogs installed on android.
Starting installation of "org.apache.cordova.dialogs" for ios
Preparing ios project
org.apache.cordova.dialogs installed on ios.
$ cordova plugin add org.apache.cordova.splashscreen
Fetching plugin from "org.apache.cordova.splashscreen"...
Starting installation of "org.apache.cordova.splashscreen" for android
Preparing android project
org.apache.cordova.splashscreen installed on android.
Starting installation of "org.apache.cordova.splashscreen" for ios
Preparing ios project
org.apache.cordova.splashscreen installed on ios.
一旦我有了这个基本的phonegap生成的应用程序,我将更改文件www/index.html中关于SplashScreen插件的phonegap文档示例代码的内容:

<!DOCTYPE html>
<html>
  <head>
    <title>Splashscreen Example</title>

    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    <script type="text/javascript" charset="utf-8">

    // Wait for device API libraries to load
    //
    document.addEventListener("deviceready", onDeviceReady, false);

    // device APIs are available
    //
    function onDeviceReady() {
        navigator.notification.alert(“Alert works…!!”);
        navigator.splashscreen.show();
    }

    </script>
  </head>
  <body>
    <h1>Example</h1>
  </body>
</html>
现在,当我使用Ripple Emulator测试应用程序时,警报显示正确,但对splashscreen.show()的调用始终返回:

未捕获的TypeError:无法调用未定义的方法“show”

因此,看起来应用程序没有找到splashscreen插件,尽管插件文件夹中的所有内容看起来都是正确的

为什么这个简单的例子不起作用?我的工作流程是否缺少某些步骤?缺少传统配置?一些插件可以在Ripple中检查和调试,而其他插件不能

我过去几天一直在努力找出问题出在哪里,但运气不好


提前感谢…

您使用phonegap创建应用程序,然后使用cordova执行其他命令。建议使用phonegap或cordova,但nox混合使用两者。我怀疑你的插件没有正确安装。你在plugins/android.json中看到它了吗?你能在platforms\android\assets\www\plugins的子文件夹中找到它吗?
$ cordova build
Generating config.xml from defaults for platform "android"
Preparing android project
Generating config.xml from defaults for platform "ios"
Preparing ios project
Compiling app on platform "android" via command "/Users/ifernandez/Duonet_Dev/Phonegap_Dev/helloworld/platforms/android/cordova/build" 
Compiling app on platform "ios" via command "/Users/ifernandez/Duonet_Dev/Phonegap_Dev/helloworld/platforms/ios/cordova/build" 
Platform "android" compiled successfully.
Platform "ios" compiled successfully.