Reputation: 163
I try to enable weinre for debugging however the problem is that weinre finds no target.
Here is what I do:
installed weinre via nodejs command: npm install weinre -g
connect my android device( Huawaei smartphone ) via USB cable and enable debugging mode on the android phone.
start weinre, command: weinre --boundHost 192.168.2.1
The index.html looks like this:
<!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>
on the config.xml i add
<access origin="http://192.168.2.1:8080/*" />
finally on the main.html ( which is the real starting page ) i add:
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
I start the app on the device. And visit the site
http://192.168.2.1:8080/client/#anonymous
=> The applications start as it ment to be but the site weinre-server shows "Target: NONE"
Am i missing something? I tried this process on firefox and chrome. I am pretty sure the mobile device does not use the 'same localhost' as my desktop pc.
the weinre server properties are:
Upvotes: 3
Views: 1864
Reputation: 1167
The correct whitelist configuration is
<content src="http://192.168.2.1:8080/*" />
Also if you have a Content-Security-Policy meta tag, you will need to set default-src *
or at least add http://*
like so per this phonegap framework doc.
<meta http-equiv="Content-Security-Policy" content="default-src * ; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src 'self' 'unsafe-inline' *; media-src *; img-src * 'self' data: file: cdvfile: http: https:; frame-src http: https: gap: cdvfile:; connect-src *">
<meta http-equiv="Content-Security-Policy" content="default-src 'self' http://*; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src 'self' 'unsafe-inline' *; media-src *; img-src * 'self' data: file: cdvfile: http: https:; frame-src http: https: gap: cdvfile:; connect-src *">
Upvotes: 0
Reputation: 1
I met the same question,because I use the "localhost:8080/target/target-script-min.js#anonymous" rather than the real IP when importing the script. when I used real ip,the target was found
Upvotes: 0