Can't find target for Android with Weinre

1,452 views
Skip to first unread message

Aeris Shimmer

unread,
Sep 29, 2013, 8:01:02 PM9/29/13
to wei...@googlegroups.com
Hi, 

I am developing an android html5 app using phone gap. in index.html I have  <script type=" text/javascript" src="http://192.168.1.6:8081/target/target-script-min.js#anonymous"></script>

On my laptop I have

C:\Users\Nicole\AppData\Roaming>weinre --httpPort 1234 --boundHost 192.168.1.6 -all-
2013-09-29T23:50:02.290Z weinre: starting server at http://192.168.1.6:1234

I can connect to http://192.168.1.6:1234 on my laptop, but cannot do it with my device. 
I have also tried the other port number such as 8080, 8081, etc. 

I am stucking on this for two days. Please help! :-)


Patrick Mueller

unread,
Sep 29, 2013, 8:17:12 PM9/29/13
to wei...@googlegroups.com


On Sunday, September 29, 2013 8:01:02 PM UTC-4, Aeris Shimmer wrote:

I am developing an android html5 app using phone gap. in index.html I have  <script type=" text/javascript" src="http://192.168.1.6:8081/target/target-script-min.js#anonymous"></script>

If you're running weinre on port 1234 (as indicated below), then you need to use 192.168.1.6:1234 instead of 192.168.1.6:8081 in the script's src attribute.
 
On my laptop I have
C:\Users\Nicole\AppData\Roaming>weinre --httpPort 1234 --boundHost 192.168.1.6 -all-
2013-09-29T23:50:02.290Z weinre: starting server at http://192.168.1.6:1234

Both your phone (or whatever is running android) and your laptop need to be on the same network.  If you're using wifi on the laptop to connect to the internet, then you connect to the same wifi on your phone, to get weinre to work.  
 
I can connect to http://192.168.1.6:1234 on my laptop, but cannot do it with my device. 
I have also tried the other port number such as 8080, 8081, etc. 

That's a good test - to just try to browse to the weinre server from your phone - once that works, then weinre should work.

Aeris Shimmer

unread,
Oct 6, 2013, 3:23:10 PM10/6/13
to wei...@googlegroups.com
Hi Patrick,

I tried what you recommended: ensuring both my laptop and my phone are on the same wifi, it still didn't work. 
Mainly I can't connect to the http:// address from my phone. 

Thanks

Patrick Mueller

unread,
Oct 6, 2013, 5:25:37 PM10/6/13
to wei...@googlegroups.com
Please post:

- ip address of the machine running weinre
- ip address of your phone
- weinre command line; please add --verbose true and --debug true
- messages from weinre
- URL you are accessing from your phone
- URL in the <script src> for the weinre target js file




--
--
From the weinre Google Group -- http://groups.google.com/group/weinre
 
---
You received this message because you are subscribed to the Google Groups "weinre" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weinre+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Patrick Mueller
http://muellerware.org

vic wang

unread,
Oct 10, 2013, 2:11:29 AM10/10/13
to wei...@googlegroups.com
how about trying other methods to debug your application.

safari and simular: i like it best,you should have mac firstly, then use the xcode to run your appplication on the simular, next step is ,open the remote debug functionality in the setting of safari. you will not miss the button in the dropdown list of tool. site:https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariWebContent/DebuggingSafarioniPhoneContent/DebuggingSafarioniPhoneContent.html

chrome: it is not convient to debug in the webview like phonegap which will talk to native.

debuggap: it is easy to include debuggap.js file into your project. then run your project,you can view element node conviently.more info. see the offical site:debuggap


在 2013年9月30日星期一UTC+8上午8时01分02秒,Aeris Shimmer写道:

Gilles Volluz-Gasdia

unread,
Nov 7, 2013, 6:54:23 AM11/7/13
to wei...@googlegroups.com
Hello Patrick,

I've got exactly the same problem as Aeris so here are the infos you requested, concerning my own case :

- ip address of the machine running weinre ==> 192.168.131.59
- ip address of your phone ==> 196.168.131.4
- weinre command line; please add --verbose true and --debug true ==> weinre --boundhost 192.168.131.59 --httpPort 8081 --verbose true --debug true
- messages from weinre

2013-11-07T11:45:42.082Z weinre: pid:                 13668
2013-11-07T11:45:42.089Z weinre: version:             2.0.0-pre-HH0SN197
2013-11-07T11:45:42.089Z weinre: node versions:
2013-11-07T11:45:42.089Z weinre:    http_parser: 1.0
2013-11-07T11:45:42.090Z weinre:    node       : 0.10.21
2013-11-07T11:45:42.090Z weinre:    v8         : 3.14.5.9
2013-11-07T11:45:42.090Z weinre:    ares       : 1.9.0-DEV
2013-11-07T11:45:42.090Z weinre:    uv         : 0.10.18
2013-11-07T11:45:42.091Z weinre:    zlib       : 1.2.3
2013-11-07T11:45:42.091Z weinre:    modules    : 11
2013-11-07T11:45:42.091Z weinre:    openssl    : 1.0.1e
2013-11-07T11:45:42.091Z weinre: options:
2013-11-07T11:45:42.092Z weinre:    httpPort:     8081
2013-11-07T11:45:42.092Z weinre:    boundHost:    localhost
2013-11-07T11:45:42.092Z weinre:    verbose:      true
2013-11-07T11:45:42.092Z weinre:    debug:        true
2013-11-07T11:45:42.093Z weinre:    readTimeout:  5
2013-11-07T11:45:42.093Z weinre:    deathTimeout: 15
2013-11-07T11:45:42.155Z weinre: starting server at http://localhost:8081


- URL you are accessing from your phone ==> http://192.168.131.59:8081
- URL in the <script src> for the weinre target js file ==> <script src="http://192.168.131.59:8081/target/target-script-min.js#anonymous"></script>

The app is a cordova one made with Icenium, using require.js, I think it doesn't play any role as when I try this with the Icenium emulator on my laptop (i.e. with localhost everywhere instead of the ip) weinre works fine.

I thought at first it might be a Windows8 firewall issue but switching it completely off didn't solve anything. It might have been a pure network issue, but if I run a xampp on :80 on my laptop, I can reach it's sites from the mobile phone so it's not that either.


Here's what weinre gives when connecting to the http://localhost:8081/client/#anonymous

2013-11-07T11:52:07.933Z weinre: --------------------------------------------------
2013-11-07T11:52:07.935Z weinre: POST / [request]
2013-11-07T11:52:07.936Z weinre:    {"id":"anonymous"}
2013-11-07T11:52:07.942Z weinre: --------------------------------------------------
2013-11-07T11:52:07.942Z weinre: POST / 200 [response]
2013-11-07T11:52:07.942Z weinre:    {"channel":"c-1","id":"anonymous"}
2013-11-07T11:52:08.024Z weinre: --------------------------------------------------
2013-11-07T11:52:08.025Z weinre: POST /c-1 [request]
2013-11-07T11:52:08.025Z weinre:    Network.cachedResources(["c-1::1"])
2013-11-07T11:52:08.101Z weinre: --------------------------------------------------
2013-11-07T11:52:08.101Z weinre: POST /c-1 [request]
2013-11-07T11:52:08.102Z weinre:    Inspector.hideDOMNodeHighlight([null])
2013-11-07T11:52:08.102Z weinre:    Runtime.releaseWrapperObjectGroup([0,"watch-group",null])
2013-11-07T11:52:08.102Z weinre:    Runtime.releaseWrapperObjectGroup([0,"watch-group",null])
2013-11-07T11:52:08.103Z weinre:    Inspector.removeAllScriptsToEvaluateOnLoad([null])
2013-11-07T11:52:08.103Z weinre:    WeinreClientCommands.getExtensions(["c-1::2"])
2013-11-07T11:52:08.103Z weinre:    Inspector.populateScriptObjects(["c-1::3"])
2013-11-07T11:52:08.104Z weinre:    Console.setConsoleMessagesEnabled([true,null])
2013-11-07T11:52:08.104Z weinre:    CSS.getSupportedCSSProperties(["c-1::4"])
2013-11-07T11:52:08.104Z weinre:    WeinreClientCommands.registerClient(["c-1::5"])
2013-11-07T11:52:08.110Z weinre: --------------------------------------------------
2013-11-07T11:52:08.111Z weinre: GET /c-1 200 [response]
2013-11-07T11:52:08.111Z weinre:    WeinreClientEvents.sendCallback(["c-1::2",[[]]])
2013-11-07T11:52:08.112Z weinre:    WeinreClientEvents.sendCallback(["c-1::5",{"channel":"c-1","id":"anonymous","hostName":"127.0.0.1","remoteAddress":"127.0.0.1"}])
2013-11-07T11:52:08.112Z weinre:    WeinreClientEvents.serverProperties([{"httpPort":"8081","boundHost":"localhost","verbose":"true","debug":"true","readTimeout":"5","boundhost":"192.168.131.59","deathTimeout":"15","staticWebDir":"C:\\Users\\Gilles\\AppData\\Roaming\\npm\\node_modules\\weinre\\web","version":"2.0.0-pre-HH0SN197"}])
2013-11-07T11:52:08.114Z weinre:    WeinreClientEvents.clientRegistered([{"channel":"c-1","id":"anonymous","hostName":"127.0.0.1","remoteAddress":"127.0.0.1"}])
2013-11-07T11:52:08.120Z weinre: --------------------------------------------------
2013-11-07T11:52:08.123Z weinre: POST /c-1 [request]
2013-11-07T11:52:08.126Z weinre:    WeinreClientCommands.getTargets(["c-1::6"])
2013-11-07T11:52:08.131Z weinre:    WeinreClientCommands.getClients(["c-1::7"])
2013-11-07T11:52:08.198Z weinre: --------------------------------------------------
2013-11-07T11:52:08.199Z weinre: GET /c-1 200 [response]
2013-11-07T11:52:08.201Z weinre:    WeinreClientEvents.sendCallback(["c-1::6",[[]]])
2013-11-07T11:52:08.206Z weinre:    WeinreClientEvents.sendCallback(["c-1::7",[[{"channel":"c-1","id":"anonymous","hostName":"127.0.0.1","remoteAddress":"127.0.0.1"}]]])

Quite puzzling... any idea ?

Thanks in advance for your time

Patrick Mueller

unread,
Nov 7, 2013, 7:25:47 AM11/7/13
to wei...@googlegroups.com
Thanks for the detailed information!

Looking back at the original post, it seemed to be "can't connect to weinre from the phone".  Is that the same problem you're seeing?  

I'm not familiar with Icenium, perhaps they have a separate support group somewhere you could ask?  A lot of these mobile frameworks figure out how to use weinre and will post some instructions, if something special is required.

Have you tried browsing to the weinre server from your phone's browser?  In your case, on that day, it would be:


Just like you browsed to it on your desktop (presumably).

Gilles Volluz-Gasdia

unread,
Nov 7, 2013, 7:43:07 AM11/7/13
to wei...@googlegroups.com
"Looking back at the original post, it seemed to be "can't connect to weinre from the phone".  Is that the same problem you're seeing?  "

Yes, from various Android devices, same problem.

"I'm not familiar with Icenium, perhaps they have a separate support group somewhere you could ask?  A lot of these mobile frameworks figure out how to use weinre and will post some instructions, if something special is required."

Maybe, but as it works "as is" on the emualor that runs locally, I wonder. I'll take a look by Icenium's support too of course, if anything comes up I'll post here.

"Have you tried browsing to the weinre server from your phone's browser?  In your case, on that day, it would be:


Just like you browsed to it on your desktop (presumably)."

First thing I tried after reading this post, to no avail.

Patrick Mueller

unread,
Nov 7, 2013, 7:55:52 AM11/7/13
to wei...@googlegroups.com
If you can't connect to the weinre client, running on your desktop/laptop, from your phone, then ... you've got basic networking problems.  Double-check the ip, the port, and the entire URL, by browsing to the weinre client from your desktop/laptop, using the ip address, and then try that exact same URL on your phone.

I believe you mentioned that you thought you could connect to port 80 on your desktop/laptop from your phone.  I wonder if you are somehow limited to only connecting to port 80 on your device or within Icenium or something.

For Cordova, we do in fact white-list URLs, so that you need to put the URL to weinre in the whitelist.  How you do that changes from release to release; check your specific Cordova release docs for more information on that.

Does Icenium also have something like a whitelist?  Again, check to see if Icenium support has any ideas.

A quick google did find this:



Gilles Volluz-Gasdia

unread,
Nov 7, 2013, 8:23:40 AM11/7/13
to wei...@googlegroups.com
Yep I found that too, but as Jim runs everything on an Apple computer I'm quite sure it won't help me and my W8 install.

At least I think, from reading his post, that it should work without configuring anything special in Icenium. It's based on cordova directly and not on phonegap and I never read there is anything like a whitelist of allowed ports.

It's also not a network issue - I've stopped weinre, restarted my xampp on port 8081 with a simple "hello world" html page and I can reach it from my phone. I can also reach a fake /target/target-script-min.js running under my xampp that simply displays an alert. 100% not a networking issue between phone and laptop.

The one thing I see that's different from Jim's blog is that his server tells him on the command line that it runs on the give ip, not localhost. On my installation, it always says "localhost", whatever I give it as boundhost - but only on the command line. If I reach the client with my browser, it gives the correct information, that's

boundHost: localhost
boundHost: 192.168.131.59

Oh. Can't believe it. Found it.

boundH<---- uppercase
and not
boundh <--- lowercase

my previous server starting command line was


weinre --boundhost 192.168.131.59 --httpPort 8081 --verbose true --debug true

and should have been

weinre --boundHost 192.168.131.59 --httpPort 8081 --verbose true --debug true

my goodness...

Hope it'll help others :D

Gilles Volluz-Gasdia

unread,
Nov 7, 2013, 7:59:10 AM11/7/13
to wei...@googlegroups.com
Yep I found that too, but as Jim runs everything on an Apple computer I'm quite sure it won't help. At least I know from reading his post that it should work without configuring anything special in Icenium. As you say, it must be a networking issue, as the browser of the phone simply can't reach the address at this port, but does on port 80. I continue digging ^^


2013/11/7 Patrick Mueller <pmu...@gmail.com>
You received this message because you are subscribed to a topic in the Google Groups "weinre" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weinre/j4iVs5xQQxs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weinre+un...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.



--
Elen síla lúmenn' omentielvo
Reply all
Reply to author
Forward
0 new messages