我尝试启用 weinre 进行调试,但问题是 weinre 找不到目标。
这是我的做法:
通过 nodejs 命令安装 weinre:npm install weinre -g
通过 USB 数据线连接我的 android 设备(华为智能手机)并在 android 手机上启用 Debug模式。
启动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 构建。在 phonegap 构建所有应用程序后,我使用移动设备扫描条形码。现在设备开始下载应用程序。
我在设备上启动应用程序。并访问网站
http://192.168.2.1:8080/client/#anonymous
=> 应用程序正常启动,但站点 weinre-server 显示“Target: NONE”
我错过了什么吗? 我在 firefox 和 chrome 上试过这个过程。我很确定移动设备不会使用与我的台式机相同的“本地主机”。
weinre 服务器属性是:
最佳答案
我遇到了同样的问题,因为我在导入脚本时使用了“localhost:8080/target/target-script-min.js#anonymous”而不是真实IP。当我使用真实ip时,发现了目标
关于android - phonegap weinre 找不到目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24752411/