Cordova 无法调用方法';保存屏幕截图';未定义的科尔多瓦

Cordova 无法调用方法';保存屏幕截图';未定义的科尔多瓦,cordova,plugins,undefined,screenshot,Cordova,Plugins,Undefined,Screenshot,您好,这是我的第一篇文章,但我一直在尝试从这里使用屏幕截图插件: 我得到了这个错误:uncaughttypeerror:无法调用未定义的at文件的方法“SaveScreenshot”。。。 我真的不知道为什么它会给我一个错误!!欢迎任何帮助 下面是调用该方法的JS: document.addEventListener("deviceready", onDeviceReady, false); // PhoneGap is ready // functi

您好,这是我的第一篇文章,但我一直在尝试从这里使用屏幕截图插件:

我得到了这个错误:uncaughttypeerror:无法调用未定义的at文件的方法“SaveScreenshot”。。。 我真的不知道为什么它会给我一个错误!!欢迎任何帮助

下面是调用该方法的JS:

document.addEventListener("deviceready", onDeviceReady, false);
        // PhoneGap is ready
        //
     function onDeviceReady() {
        $('#saveBtn').click(function(){
            window.plugins.Screenshot.saveScreenshot();
        }); 
  }
这是按钮的html

<button id="saveBtn">Save</button><br>
保存
我已经获取了Screenshot.js文件和所有内容

编辑:如果有帮助,我正在使用Cordova 2.0.0,并且我正在使用为同一版本的Cordova编码的插件屏幕截图,请尝试:

window.plugins.screenshot.saveScreenshot();
从源代码
windows.plugins.screenshot
中可以看到所有小写字符:

if (!window.plugins.screenshot) { 
    window.plugins.screenshot = cordova.require("cordova/plugin/screenshot");
}

我也面临同样的问题。在这里,我为我解释问题的原因。转到plugin config.xml,查看目录路径是否正确

<js-module src="www/hello.js" name="hello">
<clobbers target="cordova.plugins.hello" />



具体说明路径。有时它会浪费我们的时间。

这个错误是在按下按钮时发生的还是在按下按钮之前发生的?当按下按钮时try:
window.plugins.screenshot.saveScreenshot()
不起作用它只是给了我一个更多错误的列表,这些错误是什么?查看Screenshot.js的源代码,
windows.plugins.Screenshot
看起来都是小写:
if(!window.plugins.Screenshot){window.plugins.Screenshot=cordova.require(“cordova/plugin/Screenshot”);}
<config-file target="res/xml/config.xml" parent="/*">
  <feature name="Hello">
    <param name="android-package" value="com.example.hello.Hello"/>
  </feature>
</config-file>

<source-file src="src/android/Hello.java" target-dir="src/com/example/hello"/>