In this tutorial we will show you how to debug a Tabris.js application running on your Android phone using the Over the Air debug protocol. To get started you will need:
- A Tabris.js account
- The Tabris.js developer app deployed on your Android phone
- Eclipse and Eclipse Chrome Dev tools plugin
1. Create a Tabris.js Account
After you’ve signed in, you can start writing Tabris.js apps directly in your browser using the on-line editor provided.
2. Download the Tabris.js Developer App
The Tabris.js Developer App allows you to deploy your scratch pad, or any GitHub project, directly to your phone over-the-air. This cycle is one of the fastest development / deployment cycles in the mobile industry. Once you install the Developer App you can login with your GitHub credentials. Finally, choose My Scratchpad under My Scripts to execute your first Tabris.js app.
3. Install the Tooling
To debug your Tabris.js app, you need to install Eclipse and Chrome Dev Tools for Eclipse. If you don’t have Eclipse installed, you can download an Eclipse package from here. Choose Help->Install New Software and add the following update site to your list.
4. Debug your App
To get you started, we will debug the following Tabris.js App.
This app starts a counter once the ‘Start’ button has been pressed. You will notice that if you press the Start button a second time, a second timer will start and they will both access the same counter variable.
4.1 Connecting to your device
To connect to your device, ensure that your app is currently running. With the Eclipse Tooling installed, choose Run->Debug Configurations, choose Standalone V8 VM and create a new Configuration. Enter the IP of your device and the port 20001. The IP of your device can be found on the Wi-Fi settings page under the ‘Advanced’ menu option.
Once connected, the source code will be downloaded from your device and displayed in Eclipse.
If you edited your sources using the Scratchpad, your Application will be called app.js. Open this file in the navigator. Breakpoints can be set by double clicking in the margin.
The variable view can also be used to see the current value of any variable accessible from the current function.
Thank you for reading about how to Debug Tabris.js apps using the over-the-air debug protocol. As always, if you have any questions or comments, please don’t hesitate to contact us. For further readings on Tabris.js, check out How To Build a Tabris.js App in 10 minutes.