“无法运行构造函数:ReferenceError:找不到变量:PluginManager”在安卓中
我正在使用 Phone Gap 在 Android 中开发一个应用程序。在模拟器上部署应用程序时,我收到此错误日志
01-25 12:41:13.773: D/PhoneGapLog(491): Failed to run constructor: ReferenceError: Can't find variable: PluginManager
01-25 12:41:13.773: D/PhoneGapLog(491): file:///android_asset/www/phonegap-1.3.0.js: Line 210 : Failed to run constructor: ReferenceError: Can't find variable: PluginManager
01-25 12:41:13.773: I/Web Console(491): Failed to run constructor: ReferenceError: Can't find variable: PluginManager at file:///android_asset/www/phonegap-1.3.0.js:210
即使我的应用程序正常工作,也会出现错误。
我的 .js 文件是
function GpsDetactionPlugin() {
};
GpsDetactionPlugin.prototype.checkGPS = function(suc,fail) {
return PhoneGap.exec(suc, fail, "GpsDetactionPlugin", "gpsDetect", [null]);
};
PhoneGap.addConstructor(function() {
PhoneGap.addPlugin("gpsDetaction", new GpsDetactionPlugin());
});
为什么我收到这个不必要的错误日志。如何阻止它?
I am using Phone Gap to develop an app in Android. While deploying the app on emulator, I am getting this error logs
01-25 12:41:13.773: D/PhoneGapLog(491): Failed to run constructor: ReferenceError: Can't find variable: PluginManager
01-25 12:41:13.773: D/PhoneGapLog(491): file:///android_asset/www/phonegap-1.3.0.js: Line 210 : Failed to run constructor: ReferenceError: Can't find variable: PluginManager
01-25 12:41:13.773: I/Web Console(491): Failed to run constructor: ReferenceError: Can't find variable: PluginManager at file:///android_asset/www/phonegap-1.3.0.js:210
Even though my application works, then also the errors comes.
My .js file is
function GpsDetactionPlugin() {
};
GpsDetactionPlugin.prototype.checkGPS = function(suc,fail) {
return PhoneGap.exec(suc, fail, "GpsDetactionPlugin", "gpsDetect", [null]);
};
PhoneGap.addConstructor(function() {
PhoneGap.addPlugin("gpsDetaction", new GpsDetactionPlugin());
});
Why am i getting this unnecessary error log.How to stop it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
JS 代码对我来说看起来很好,我怀疑问题出在其他地方。我在以下位置有一个示例phonegap 插件,您可以检查该插件是否已正确设置所有配置。确保您已将插件信息放入 res/xml/plugin.xml
https://github.com/dhavaln/phonegap-examples/tree/master/phonegap-plugin-test
The JS code looks fine to me and I suspect the issue is somewhere else. I have a sample phonegap plugin at the following location which you can check to see that you have put all the configurations correct. Make sure you have put the plugin info in res/xml/plugin.xml
https://github.com/dhavaln/phonegap-examples/tree/master/phonegap-plugin-test