我尝试启用weinre进行调试,但问题是weinre找不到目标。
以下是我的操作步骤:
通过nodejs命令安装weinre:npm install weinre -g
通过USB电缆连接我的安卓设备(华为智能手机)并在手机上启用调试模式。
启动weinre,命令为:weinre --boundHost 192.168.2.1
index.html看起来像这样:
<!doctype html>
<html>
<head>
<title>tittle</title>
<!-- Weinre testing for remote debug with physical device -->
<script src="http://192.168.2.1:8080/target/target-script-min.js#anonymous"></script>
<script>window.location='./main.html';</script>
<body>
</body>
</html>
在config.xml文件中,我添加了以下内容:
<access origin="http://192.168.2.1:8080/*" />
最终,在主页面main.html(即真正的起始页面)中我添加了以下内容:
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
- 然后我将应用所需的所有文件压缩并上传到PhoneGap Build。在PhoneGap Build完成后,我使用移动设备扫描条形码。现在设备开始下载应用程序。
我在设备上启动应用,并访问该网站。
http://192.168.2.1:8080/client/#anonymous
=> 应用程序启动得如愿,但 weinre-server 网站显示 "目标:无"
我是否遗漏了什么?我在 Firefox 和 Chrome 上尝试了这个过程。我非常确定移动设备不使用与我的桌面电脑相同的本地主机。
weinre 服务器属性为: