android - phonegap weinre 找不到目标

标签 android node.js cordova phonegap-build weinre

我尝试启用 weinre 进行调试,但问题是 weinre 找不到目标。

这是我的做法:

  1. 通过 nodejs 命令安装 weinre:npm install weinre -g

  2. 通过 USB 数据线连接我的 android 设备(华为智能手机)并在 android 手机上启用 Debug模式。

  3. 启动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 服务器属性是:

enter image description here

最佳答案

我遇到了同样的问题,因为我在导入脚本时使用了“localhost:8080/target/target-script-min.js#anonymous”而不是真实IP。当我使用真实ip时,发现了目标

关于android - phonegap weinre 找不到目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24752411/

相关文章:

node.js - node-postgres 是否支持多个结果集

android - Phonegap - cordova 在 Android 和 iOS 设备上缓慢且缓慢

java - 无法在 Android 中扫描或发现 BT 和 BLE 设备

java - Android Studio : Problems accessing Sub-Item in non activity class

android - 如何让editText插入一些样子

java - 知道字符串中确定位置的数字 - Java

javascript - 尝试使用 setTimeout 在某些 js/node 代码中阻止 sleep

javascript - 如果只有 1 个 cpu 核心,CPU 时间切片是否可以在有或没有工作线程的 Node.js 上工作?

cordova - 错误 : Failed to transpile program - ionic2

android - 方向改变时应用程序崩溃