简体   繁体   English

phonegap --autoreload和console.log无法正常工作

[英]phonegap --autoreload and console.log not working

I am building a phonegap app and need quick test feedback on the live devices 我正在构建一个phonegap应用,需要实时设备上的快速测试反馈

  • Smasung Galaxy note 3 三星银河注3
  • iPhone 5s iPhone 5S

I am using phonegap CLI to serve. 我正在使用phonegap CLI服务。

I have been building on my home desktop PC running windows 7, and am currently working elsewhere on my laptop running windows 10. Now I have run into the following problem: 我已经在运行Windows 7的家庭台式PC上进行构建,并且目前正在运行Windows 10的笔记本电脑上的其他地方工作。现在,我遇到了以下问题:

On my desktop PC: 在我的台式机上:

After each change on either the javascript or HTML file, the phonegap server autoreloads the app and the changes show almost immediately on the devices. 在任一JavaScript或HTML文件中的每个变化后,PhoneGap的服务器autoreloads应用和变化几乎立即显示在设备上。 I also get the console.log replies in the CLI. 我还在CLI中得到console.log的答复。

On my laptop: 在我的笔记本电脑上:

After each change on either the javascript or the HTML file I get a message on the CLI that the relevant file has been changed (this does not happen on my desktop PC) and there is no autoreloading of the apps on the test devices neither does it give a readout of the console.log replies and any alert() that I use in their place take much longer to pop up than normal... 在对javascript或HTML文件进行每次更改后,我在CLI上均收到一条消息,提示相关文件已更改(这在我的台式机上不会发生),并且测试设备上的应用程序不会自动重新加载给出console.log答复的读数,并且我代替它们使用的任何alert()都比正常弹出花费更长的时间...

  • I have set --autoreload when starting the phonegap server (although it's default is 'true' anyway). 我在启动phonegap服务器时设置了--autoreload(尽管无论如何它的默认值是'true')。
  • I have reinstalled phonegap. 我已经重新安装了phonegap。
  • I have run everything off a whole other network. 我已经在整个其他网络上运行了一切。
  • I have waited very patiently incase it's just slow network. 我已经非常耐心地等待,以防它只是缓慢的网络。
  • I have gotten to the point where I want to punch a baby in the face. 我已经到了要在脸上打婴儿的地步。

Is there anyone who can shed some light on how I can get the autoreload and the console.log working ??? 有谁能阐明我如何使自动重载console.log正常运行?

Regards 问候

So after some tedious debugging I found it. 因此,经过一些乏味的调试后,我发现了它。

in the head section I added: 在开头部分,我添加了:

<script type="text/javascript" src="cordova.js"></script>

although I already had: 虽然我已经有:

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

and it's still like that on my desktop PC... 仍然像我的台式机上那样

and now everything works...both the console.log and the autoreloading... 现在一切正常... console.log和自动重装...

Hope this helps someone. 希望这对某人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM