我正在使用 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());
});
为什么我会收到这个不必要的错误日志。如何停止它?
最佳答案
我觉得 JS 代码没问题,但我怀疑问题出在其他地方。我在以下位置有一个示例 phonegap 插件,您可以检查它是否已正确设置所有配置。确保您已将插件信息放入 res/xml/plugin.xml
https://github.com/dhavaln/phonegap-examples/tree/master/phonegap-plugin-test
关于android - "Failed to run constructor: ReferenceError: Can' t 找到变量 : PluginManager"in Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8999146/