Installing weinre.
weinre is a remote debugging tool for html5 developers created by Apache foundation. You can install it as an npm package using the command:
$ sudo npm install -g weinre
$ sudo npm install -g weinre
Now connect your device to the same wireless network that the computer you're using to debug is in. Find out what's your IP, on Windows the command is ipconfig while in Linux it's ifconfig as shown on the figure.
Now it's time to include your IP adress on your Apache cordova application. On index.html you must include the following scripts on the <head> tag.
And on the Manifest file located in /platforms/android/AndroidManifest.xml you must add the necessary permissions as shown.
Now load your application as usual using cordova run [PLATFORM].
Once finished, its time to start the debugging process. Open a terminal and type the command:
$ weinre --boundHost -all-
$ weinre --boundHost -all-
Now on your browser you should be able to access the weinre server on localhost with port 8080 which is the port we added on index.html. And lo and behold! If everything worked well, you'll be able to see your phonegap application on the debug server which you can click to access your phone remotely and start debugging.
If you click on it, you should be able to see the elements of the application running on cordova, including the very useful console which lets you monitor what's happening on your app.
NOTE:
While you debug both smartdevice and computer must be connected to the same network and have wireless activated.
Also weinre must keep running so that you can keep monitoring of course.
And that's it, happy debugging!
NOTE:
While you debug both smartdevice and computer must be connected to the same network and have wireless activated.
Also weinre must keep running so that you can keep monitoring of course.
And that's it, happy debugging!
References:
[1] https://www.youtube.com/watch?v=HEqwnpLYnI0&feature=youtu.be
[2] http://people.apache.org/~pmuellr/weinre-docs/latest/Installing.html
[2] http://people.apache.org/~pmuellr/weinre-docs/latest/Installing.html