0

so, I need console output via the console plugin and in order to get that I must have weinre running. The weinre instructions and tutorials are well written and extensive--I have every reason to believe I'm setup properly because from my test WP8.1 device I can use IE to navigate to my local weinre server and run the weinre red/green/blue demo. The local weinre server is running --boundHost 10.0.0.4 --debug and it accurately shows connection by the weinre demo via IE.

However, when putting <script>"http://10.0.0.4:8080/target/target-script-min.js#nokia"</script> into the template (BlankCordovaApp, the one that says "your application is ready") app's index.html (inside the head tag), building and running on Device, no attempt is made by the app to log onto the weinre server.

I'm assuming there must be a whitelist problem?

Clues are appreciated.

I would post my code but it literally is adding the script tag to the template's html... seemed excessive to me!

Tawpie
  • 271
  • 3
  • 11

1 Answers1

1

If you are targeting only WP8.1+ and are building a "packaged app" (you do not web pages access Cordova APIs), then try using the "Windows Phone (Universal)" target. This uses the updated "Windows" Cordova platform instead of WP8 and therefore has full access to the VS debugger. weinre is not required in this case and likely does not work due to the security model in place. weinre is only needed when using the WP8 Cordova Platform via the "Windows Phone 8" target.

If you do need to use the WP8 platform, first validate that the phone can actually access the IP that you list above. A simple way to do this is to go to the browser on the phone and navigate to the URI above. It sounds like that did in fact work for you, so assuming it can access the URI and you are in fact using the WP8 Cordova platform, you could be running into a shortcoming with weinre. It is JavaScript based and as a result, there are occasions when a problem with your app code can cause it to cease functioning. Fortunately there is a fallback for console access. If you go into the bld/Debug/platforms/wp8 folder and open the solution found there you can run the app and you will see console output in the "Output" window.

Edit: CTP3 does not currently support debugging Windows Phone (Universal) directly but going to the bld/Debug/platforms/windows folder and opening the solution there does. A soon to be released update will address this issue.

Chuck Lantz
  • 1,440
  • 1
  • 8
  • 10
  • Thank you Chuck... replying below because I can't put carriage returns in comments! – Tawpie Feb 24 '15 at 16:37
  • Thank you Chuck... So the answer is that the security model on WP8.1 does not allow downloading the .js file, which of course means that Weinre is not a true option. I happened to notice in Output>Show output from: Javascript Language Service a couple of messages indicating that VS was trying to download the js, but was unable to (no reason given). Unfortunately, the "Windows" Cordova platform's full access to the VS debugger is still awaiting release in the "next version" and doesn't work with CTP3 of Tools for Apache Cordova (once the app launches, the debugger disconnects with error 0). – Tawpie Feb 24 '15 at 17:15
  • As you mentioned, the alternative for debugging is to run the silverlight (that is created in the CordovaApp.sln) inside bld/Debug/Platforms/windows--it works. We can complain about how smoothly it works later. I'm marking this as the answer... although it's not quite the answer! – Tawpie Feb 24 '15 at 17:15
  • Ah yes, the good news is that the shortcoming you mention with Windows Phone 8.1 with Tools for Apache Cordova CTP 3 will be resolved in a soon to be released update which should smooth out that workflow for you. – Chuck Lantz Feb 24 '15 at 20:05