PhoneGap Development Environment
Debugging PhoneGap Applications
This presentation has been developed in the context of the Mobile Applications Development course at the Computer Science Department of the University of L’Aquila (Italy).
Text 2 Sublime Text 2 – http://www.sublimetext.com – http://www.sublimetext.com • SublimeText SublimeText SublimeText SublimeText Package Package Package Package Control Control Control Control – http://wbond.net/sublime_packages/package_control • HTML HTML HTML HTML Prettify Prettify Prettify Prettify HTML HTML HTML HTML Prettify Prettify Prettify Prettify – https://github.com/victorporof/Sublime-HTMLPrettify • JSHint JSHint JSHint JSHint – http://www.jshint.com/
browser Desktop browser Desktop browser Desktop browser – This works for functionalities not relying on – This works for functionalities not relying on PhoneGap – You may use PhoneGap shimmers here 2. Run in the simulator simulator simulator simulator & test in the Desktop browser – Very handy & accurate – Very handy & accurate 3. Run on the device device device device & debug in the Desktop browser – Complete control & confidence
handy handy handy handy functions + very handy handy handy handy functions see Chrome’s Web Development Tools + direct direct direct direct + Breakpoints Breakpoints Breakpoints Breakpoints - cannot test user user user user agent agent agent agent’s metadata - browsers’ small differences differences differences differences and bugs - browsers’ small differences differences differences differences and bugs - cannot test all PhoneGap PhoneGap PhoneGap PhoneGap’s specific functionalities - you need PhoneGap shims
calls from a local local local local web app, you need to relax Chrome’s security policies with respect to local files access and cross-domain app, you need to relax Chrome’s security policies with respect to local files access and cross-domain resources access OSX OSX OSX OSX open -a Google\ Chrome.app --args “ --disable-web-security“ Windows Windows Windows Windows chrome.exe --disable-web-security DO IT ONLY FOR DEBUGGING!!!
webkit browser 2. Copy debugdata.json into the root www folder of your app’s project 3. Use phonegap-desktop.js in place of the standard phonegap library 4. modify to your specific needs 4. modify debugdata.json to your specific needs
’s browser ’s browser ’s browser + very handy handy handy handy functions + very handy handy handy handy functions + see Chrome’s Web Development Tools + d d d direct irect irect irect + breakpoints breakpoints breakpoints breakpoints - d d d device evice evice evice’s performance ’s performance ’s performance ’s performance is not considered this is iOS-specific - p p p performances erformances erformances erformances may be biased - p p p performances erformances erformances erformances may be biased usually you need some kind of hook within your app - device device device device’s ’s ’s ’s capabilities capabilities capabilities capabilities are only simulated
handy handy handy + still handy handy handy handy + accurate performance accurate performance accurate performance accurate performance tests + a a a accurate browser ccurate browser ccurate browser ccurate browser’s tests - You need to deploy deploy deploy deploy the app to a real device - You need to deploy deploy deploy deploy the app to a real device - No breakpoints breakpoints breakpoints breakpoints
3 3 main main main main components components components components: : : : • Debug Debug Debug Debug Server Server Server Server: the HTTP server that’s used by the Debug Client and Debug Target Debug Client and Debug Target • Debug Debug Debug Debug Client Client Client Client: the Web Inspector user interface • Debug Debug Debug Debug Target Target Target Target: the (web) app you are debugging
Desktop Desktop Ripple Ripple Ripple Ripple iWebInspector iWebInspector iWebInspector iWebInspector Weinre Weinre Weinre Weinre The The The The Craftsman Craftsman Craftsman Craftsman way way way way iOS iOS iOS iOS Android Android Android Android craftsman craftsman craftsman craftsman way way way way: console.log() + alert() craftsman craftsman craftsman craftsman way way way way: console.log() + alert()
you can use Adobe Adobe Adobe Adobe Shadow Shadow Shadow Shadow devices you can use Adobe Adobe Adobe Adobe Shadow Shadow Shadow Shadow http://labs.adobe.com/technologies/shadow/
MY development environment and the debugging tools I I I I use the debugging tools I I I I use Consider them as a starting point & feel free to use others